home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d10 / ps1410.arc / CAL4.BAS < prev    next >
BASIC Source File  |  1990-10-31  |  78KB  |  2,105 lines

  1.     '=========================================================================
  2.     ' Personal Calendar (PC) Program
  3.     '  Copyright (c) 1985-1990, Paul Munoz-Colman.  All Rights Reserved.
  4.     '    Version 14.10
  5.     '     31 Oct 1990
  6.     '    Shareware $25
  7.     '=========================================================================
  8.     '              DOS File CAL4.BAS
  9.     '  Independently Compiled Subprograms Which Are Linked With CAL1.BAS
  10.     '=========================================================================
  11.     '  Written For IBM PCs & Compatibles Under MS DOS 3.30 on a Northgate 486
  12.     '   Compiled By Microsoft Professional BASIC 7.10, Linker Version 5.10
  13.     '=========================================================================
  14.     '  Note -- Tabs in the source file are in positions 6,11,16,21,26,...
  15.     '=========================================================================
  16.     ' $INCLUDE: 'cal1.bi'
  17.     '=========================================================================
  18.     '  Subprogram List in the Order of Appearance in this File
  19.     '   (compiled WITHOUT error handling--no /E or /X)
  20.     '-------------------------------------------------------------------------
  21.     '    Name                          Purpose
  22.     '    ---------------------------   ---------------------------------------
  23.     ' Fn    InString                    Interface with MhInstr
  24.     '    Instructions                  Bottom of Clock Screen Instructions
  25.     '    KeyStuff (KeyFunction)        Get a Keystroke, Display Key States
  26.     '    KillAFile (Filename$)        Interface with MhKill
  27.     '    Kolors (WhichSetting)         Change Color Setting
  28.     ' Fn Leap (LeapInput)              Check if Given Year is a Leap Year
  29.     '    LprintString (PrintString$,HoldPrint)
  30.     '                                  Send to Printer With Error Recovery
  31.     '    MajorBeeper                   Severe Attention Music (Errors)
  32.     '    MenuDriver (MenuSize, MenuChoice, MenuRow, MenuColumn,
  33.     '         MenuSingleLine, MenuSpecialExit, ScreenBottomsShow, FilenameShow)
  34.     '                                  Menu Processor
  35.     '    MinorBeeper                   Mild Attention Music (Messages)
  36.  
  37.     '    MoveApptRecords
  38.     '         (FileStart, MoveStart, MoveEnd, MoveIncr, MoveOrigin,
  39.     '          MoveTarget, MoveFlag, BlankFlag, BlankAt)
  40.     '                                  Shift Records In Appointment File
  41.     '    Myd2 (Destin$, DestinStart%, Chars%, Source$)
  42.     '                            Interface with MhMidString (Statement)
  43.     '    NotesHistory (NotesorHistory$)
  44.     '                                  Change Notes and History Menu
  45.     ' Fn    NumberError (NumberTest$)     Check for Non-Numeric Characters
  46.     '    OpenAppts                     Open Appointment File and Set FIELD
  47.     '    Options                       Options Menus
  48.     '    PageEject                     Eject Printer Page
  49.     '    PlayAlarmWarning (WarningSet)
  50.     '                                  Play Alarm or Warning Music String
  51.     '    PopLine                       F10 to Pop Down Prompt
  52.     '    PopLineDelete                 Erase Pop Down Prompt
  53.     '=========================================================================
  54.     FUNCTION InString (SearchIn$, SearchFor$)  STATIC
  55.     '=========================================================================
  56.     '   Interface to MhInstr, Ditches Two Arguments
  57.     DEFINT A-Z
  58.         SubnumSave = Subnum
  59.         Subnum = 117
  60.     CALL MhInstr(Pointer%, N1%, SearchIn$, SearchFor$)
  61.     InString = Pointer
  62.         Subnum = SubnumSave
  63.     END FUNCTION
  64.     '=========================================================================
  65.     SUB Instructions STATIC
  66.     '=========================================================================
  67.     '   Refresh Bottom Of Clock Display User Instructions
  68.     DEFINT A-Z
  69.         SubnumSave = Subnum
  70.         Subnum = 34
  71.     IF ApptFile AND FooterSize >= N6 THEN         ' Show F5 Help
  72.         ScreenColumn = N1                        '  or Blank it out
  73.         SELECT CASE FooterSize
  74.             CASE N6, N7
  75.                 F5HelpRow = N18
  76.             CASE N8
  77.                 F5HelpRow = N17
  78.             CASE N9
  79.                 F5HelpRow = N16
  80.         END SELECT
  81.         IF NOT FooterRecall THEN                ' Show F5 Help
  82.             CALL ShowIt(N7, F5HelpRow, N1, "F5")
  83.             CALL ShowIt(N6, N0, Nm1, " Help ")
  84.             IF FooterSize = N6 THEN CALL ShowIt(N3, N25, N1, Blank80$)
  85.             GOTO AllOver
  86.           ELSE
  87.             CALL ShowIt(N3, F5HelpRow, N1, Blank8$)   ' Blank F5 Help
  88.         END IF
  89.     END IF
  90.     '  Instructions Refresh
  91.     CALL ShowMult(N6, N22, N1, N80, N4)
  92.     '           Clear Area First
  93.     IF NOT ApptFile THEN
  94.         CALL ShowIt(N7, N23, Column1, "E")
  95.         CALL ShowIt(N6, N0, Nm1, " Use Appointment File")
  96.       ELSE
  97.         CALL ShowIt(N7, N23, Column1, "E,F3")
  98.         CALL ShowIt(N6, N0, Nm1, " Events")
  99.     END IF
  100.     CALL ShowIt(N7, N24, Column1, "D")
  101.     IF NOT OtherCalendars THEN
  102.         CALL ShowIt(N6, N0, Nm1, " Show Specific Date")
  103.       ELSE
  104.         CALL ShowIt(N6, N0, Nm1, " Show Date  ")
  105.         CALL ShowIt(N7, N0, Nm1, "T")
  106.         CALL ShowIt(N6, N0, Nm1, " Today")
  107.     END IF
  108.     CALL ShowIt(N7, N25, Column1, "S")
  109.     CALL ShowIt(N6, N0, Nm1, " Sound Setting")
  110.     CALL ShowIt(N6, N22, (Column4 + N3), "Scroll:")
  111.     '  West-Arrow Followed By East-Arrow
  112.     CALL ShowIt(N7, N23, Column4, _
  113.         (Blank1$ + LeftArrow$ + RightArrow$ + Blank1$))
  114.     CALL ShowIt(N6, N0, Nm1, " Calendars")
  115.     IF ApptFile THEN
  116.         CALL ShowIt(N7, Nm1, Column4, (Blank1$ + UpArrow$ + DownArrow$ + _
  117.             Blank1$))
  118.         CALL ShowIt(N6, N0, Nm1, "    Notes ")
  119.         CALL ShowIt(N7, Nm1, Column4, "PgUp/Dn")
  120.         CALL ShowIt(N6, N0, Nm1, " Events")
  121.     END IF
  122.     IF ApptFile THEN
  123.         CALL ShowIt(N7, N24, Column2, "*,Print")
  124.         CALL ShowIt(N6, N0, Nm1, " Print")
  125.         CALL ShowIt(N7, N25, Column2, "End")
  126.         CALL ShowIt(N6, N0, Nm1, "     Eject")
  127.     END IF
  128.     CALL ShowIt(N7, N22, Column3, "Esc")
  129.     CALL ShowIt(N6, N0, Nm1, "      Menu")
  130.     CALL ShowIt(N7, N23, Column3, "Ctrl-Esc")
  131.     CALL ShowIt(N6, N0, Nm1, " Quit")
  132.     CALL ShowIt(N7, N24, Column3, "F6,F7")
  133.     CALL ShowIt(N6, N0, Nm1, "    DOS")
  134.     IF NOT DOS2x THEN
  135.         CALL ShowIt(N7, N25, Column3, ("F10," + UpArrow$ + "F10"))
  136.         CALL ShowIt(N6, N0, Nm1, " Pop Down")
  137.     END IF
  138.     IF ApptFile THEN
  139.         CALL ShowIt(N7, N22, Column2, "H")
  140.         CALL ShowIt(N6, N0, Nm1, "       History")
  141.         CALL ShowIt(N7, N23, Column2, "N,F4")
  142.         CALL ShowIt(N6, N0, Nm1, "    Notes")
  143.         IF OverdueCount THEN
  144.             CALL ShowIt(N7, N22, Column1, "Del")
  145.             CALL ShowIt(N6, N0, Nm1, " Erase Overdue")
  146.         END IF
  147.     END IF
  148. AllOver:
  149.     RefreshInstructions = No
  150.         Subnum = SubnumSave
  151.     END SUB
  152.     '=========================================================================
  153.     SUB KeyStuff (KeyFunction) STATIC
  154.     '=========================================================================
  155.     DEFINT A-Z
  156.         SubnumSave = Subnum
  157.         Subnum = 35
  158.     '  General Keystroke Processing, Status Testing/Display, Key Traps
  159.     '    KeyFunction is input
  160.     '         KeyStatus      (=1)  get/display caps/num/ins/out status if chgd
  161.     '         KeySingle      (=2)  get one keystroke and display status
  162.     '         KeyWait        (=3)  wait for a keystroke
  163.     '         KeyCursor      (=4)  move cursor (all locate requests)
  164.     '         KeyCursorOff   (=-4) move cursor, turn off, set DOS shape
  165.     '         KeyNumOn       (=5)  enable Numlock
  166.     '         KeyNumOff      (=6)  disable Numlock
  167.     '         KeyTimerInit   (=7)  Initialize Timer Box (may force StatusAbs)
  168.     '         KeyStatusAbs   (=8)  Show state flags unconditionally
  169.     '         CursorRow,CursorColumn = Cursor Location
  170.     '=========================================================================
  171.     '  Do is for Keystroke Waiting
  172.     '   Any other call exits after one pass at Loop statement
  173.     '-------------------------------------------------------------------------
  174.     DO
  175.         '====================================================================
  176.         '  Previous Exit Leaves If Exiting is Enabled -- EXITS PROGRAM !!
  177.         '    (Delays Program Exit If Appointment File is Being Written)
  178.         IF ExitKeys AND KeyDelayedExit THEN CALL EndItAll
  179.         '----------------------------------------------------------------
  180.         '  See if Insert Being Pressed and Released
  181.         '  This overrides MhInStat just for the Insert Key
  182.         InsertKeyed = No                   ' Reset Insert Off Action Flag
  183.         DO
  184.             '---------------------------------------------------------------
  185.             '    Get the Scan Codes if a Key is in the Keyboard Buffer
  186.             CALL MhInStat(KshiftIn%, KscanIn%, KasciiIn%)
  187.             PriorInsert = InsertPressing%
  188.             CALL MhGetKbStatus2(InsertPressing%, C%, N%, S%, A%, T%, L%, R%)
  189.             IF PriorInsert <> InsertPressing% AND _
  190.                InsertPressing% <> N0                 THEN
  191.                 InsertKeyed = Yes        ' Due to error in MhGetKbStatus2
  192.                 KscanIn% = 82            ' if MhSet on numlock has been used
  193.                 KasciiIn% = N0            ' sense of insert key depends on
  194.                 IF AllowInsertMode THEN
  195.                     KscanIn% = N0
  196.                     K$ = INKEY$
  197.                     InsertKeyed = No
  198.                 END IF
  199.             END IF                        ' so wait here for both
  200.         LOOP WHILE InsertPressing%
  201.         '---------------------------------------------------------------
  202.         '   Turn Insert Mode Off if On and Not Allowed -- Automatically
  203.         CALL MhGetKbStatus1(Insrt%, C%, N%, S%, A%, T%, L%, R%)
  204.         IF Insrt% = N1 AND AllowInsertMode = No THEN
  205.             CALL MhSetKbStatus(N0%, N3%, N3%, N3%)
  206.         END IF
  207.         '----------------------------------------------------------
  208.         '  Test for Exit Keys (Ctrl-Esc and Ctrl-Break)
  209.         IF (KshiftIn% AND N4) = N4 THEN      ' if Ctrl was With it
  210.             IF KscanIn% = N1% OR KscanIn% = 70 THEN '  Treat Ctrl-Esc/Brk
  211.                 IF ExitKeys THEN              '  As an exception
  212.                     CALL EndItAll        ' PROGRAM ENDS!!
  213.                   ELSE
  214.                     KeyDelayedExit = Yes' Or Ends Delayed
  215.                     K$ = INKEY$
  216.                     KscanIn = N0
  217.                     KasciiIn = N0
  218.                 END IF
  219.             END IF
  220.         END IF
  221.         '--------------------------------------------------------------------
  222.         '    POP DOWN REQUEST !!
  223.         ' F10 is pop-down key for normal pop down
  224.         ' Shift-F10 is pop-down key for one-time disable of auto-pop up
  225.         '  Don't Let New User Become Resident Before Help is Invoked
  226.         '  Delay Pop-Down if Appt File Writing is Serious
  227.         IF KasciiIn = N0 THEN
  228.             SELECT CASE KscanIn
  229.                 CASE 68                            ' F10
  230.                         PopDown = Yes
  231.                 CASE 93                            ' Shift-F10
  232.                     IF (KshiftIn AND N3) THEN      '  (either shift key)
  233.                         PopDown = Yes
  234.                         AllowPopDateTimeSave = AllowPopDateTime
  235.                         AllowPopDateTime = No
  236.                     END IF
  237.             END SELECT
  238.         END IF
  239.         IF SrAutoPopDown AND NOT SrAutoPopDownHappened AND _
  240.            SrAutoPopDownReady                             THEN
  241.             PopDown = Yes
  242.         END IF
  243.         IF (PopWait OR PopDown) AND NOT DOS2x AND NOT NewGuy AND _
  244.             NOT InPopDown AND NOT SrAutoOptions THEN
  245.             IF NOT ExitKeys THEN               ' If no exit
  246.                 PopWait = Yes                 '   wait, else
  247.               ELSE
  248.                 PopDown = No
  249.                 PopWait = No
  250.                 '  If this is called from Snooze while already popping down
  251.                 '   then the pop down returns without doing anything.
  252.                 '   This avoids hangs from recursive pop down requests.
  253.                 '----------------------------------------------------------
  254.                 CALL StayResPopDown           ' POP DOWN HERE !!
  255.                 '----------------------------------------------------------
  256.             END IF
  257.             K$ = INKEY$
  258.             KscanIn% = N0
  259.             KasciiIn% = N0
  260.           ELSE
  261.             PopDown = No
  262.             PopWait = No
  263.         END IF
  264.         '---------------------------------------------------------------
  265.         IF KeyFunction = KeySingle OR KeyFunction = KeyWait THEN
  266.             '===============================================================
  267.             Keystroke$ = Blank0$          ' Discard Previous Keystroke
  268.             '===============================================================
  269.             '   THIS IS WHERE ALL PROGRAM CALLS GET A KEYSTROKE
  270.             '---------------------------------------------------------------
  271.             '  Assumption is that if a call asked for a keystroke,
  272.             '   it used it before coming back here for ANY reason, so ...
  273.             '---------------------------------------------------------------
  274.             IF KscanIn% OR KasciiIn% OR InsertKeyed THEN
  275.                 '----------------------------------------------------------
  276.                 '  Empty Keystroke Buffer Because There May be Something
  277.                 '   (Buffer can fill up if it isn't emptied every time)
  278.                 '    Only use of Inkey$ in this Program
  279.                 '    Except For Final Exit Code and Pop Down
  280.                 '----------------------------------------------------------
  281.                 '    Reset Flag to Discard Keystroke
  282.                 '    Null Out Prior Keystroke if New One Asked For
  283.                 '  Must Assume Keystroke Acted Upon If Gotten Previously
  284.                 DiscardKeystroke = No
  285.                 Keystroke$ = INKEY$
  286.                 '----------------------------------------------------------
  287.                 '  Test for Either Shift Key Pressed for Key Traps
  288.                 '   Also test for Ctrl-Left/Right Arrows
  289.                 IF KeyTrapEnabled AND KeyShiftTrap = N0 THEN
  290.                     IF KShiftIn% AND N3 THEN
  291.                         SELECT CASE KscanIn%
  292.                             CASE N15                  ' Shift-Tab
  293.                                 KeyShiftTrap = N2
  294.                             CASE N28                  ' Shift-Return
  295.                                 KeyShiftTrap = N3
  296.                             CASE 83, 130             ' Shift-Delete
  297.                                 KeyShiftTrap = N4
  298.                         END SELECT
  299.                       ELSEIF KShiftIn% AND N4 THEN
  300.                         SELECT Case KscanIn%
  301.                             CASE 116                ' Ctrl-Right-Arrow
  302.                                 KeyShiftTrap = N5
  303.                             CASE 115                ' Ctrl-Left-Arrow
  304.                                 KeyShiftTrap = N6
  305.                         END SELECT
  306.                     END IF
  307.                     '  Discard Saved Keystroke if Trap was Set
  308.                     IF KeyShiftTrap THEN DiscardKeystroke = Yes
  309.                 END IF
  310.                 '-----------------------------------------------------------
  311.                 IF InsertKeyed AND NOT AllowInsertMode THEN
  312.                     Keystroke$ = Blank1$ + CHR$(Ins)
  313.                 END IF
  314.                 '-----------------------------------------------------------
  315.                 '  If keystroke is a throwaway, null it out here
  316.                 IF DiscardKeystroke THEN
  317.                     Keystroke$ = Blank0$
  318.                 END IF
  319.                 '-----------------------------------------------------------
  320.                 IF DebugRequested THEN        ' Keystroke Debug Information
  321.                     CALL ShowIt(N6, N3, N30, (STR$(KshiftIn%) + _
  322.                         STR$(KscanIn%) + STR$(KasciiIn%) + _
  323.                         STR$(InsertKeyed) + SPACE$(N1)))
  324.                 END IF
  325.                 '-----------------------------------------------------------
  326.             END IF                             ' End of Key Look-Ahead
  327.             '----------------------------------------------------------------
  328.         END IF                        ' End of Real Keystroke Function
  329.         '====================================================================
  330.         '  Forced Key Changes
  331.         SELECT CASE KeyFunction            ' Process Requested Actions
  332.             CASE KeyNumOff                     ' means disable Numlock
  333.                 CALL MhSetKbStatus(N3%, N3%, N0%, N3%)  ' Turn NumLock Off
  334.             CASE KeyNumOn                      ' means enable Numlock
  335.                 CALL MhSetKbStatus(N3%, N3%, N1%, N3%)  ' Turn NumLock On
  336.             CASE KeyCursor                     ' means turn cursor on
  337.                 CursorState = N1
  338.             CASE KeyCursorOff                  ' means turn cursor off
  339.                 CursorState = N0
  340.         END SELECT
  341.         '--------------------------------------------------------------------
  342.         '  Get Current Status of CapsLock, NumLock and Insert
  343.         CALL MhGetKbStatus1(Insrt%, Caps%, Num%, S%, A%, T%, L%, R%)
  344.         '====================================================================
  345.         '  Show Cursor If Requested or if state changed
  346.         IF Insrt% <> InsertHold OR CursorState <> CursorStateHold OR _
  347.            KeyFunction = KeySingle OR KeyFunction = KeyWait OR _
  348.            KeyFunction = KeyCursor OR KeyFunction = KeyCursorOff THEN
  349.             IF Insrt% = N1 THEN                    ' Check insert state
  350.                 CursorStart = InsertCursorStart    ' DOS Size Cursor
  351.               ELSE
  352.                 CursorStart = OverstrikeCursorStart ' Full Cursor
  353.             END IF
  354.             LOCATE CursorRow, CursorColumn, CursorState, CursorStart, _
  355.                 CursorStop
  356.             CursorStateHold = CursorState                ' Save State
  357.         END IF
  358.         '====================================================================
  359.         '  Update Key Status If Anything's Changed or Forced Request
  360.         IF KeyFunction >= KeyTimerInit OR KeyDelayedExit = Yes OR _
  361.           Caps% <> CapsHold OR Num% <> NumHold OR Insrt% <> InsertHold OR _
  362.           PopWait <> PopWaitHold OR MemoryResident <> ResHold             THEN
  363.             '===============================================================
  364.             IF StartupScreen THEN
  365.                 ClearChar$ = "═══"            ' Horizontal Double Box Char
  366.               ELSEIF ClearChar$ <> SPACE$(N3) THEN
  367.                 ClearChar$ = SPACE$(N3)
  368.             END IF
  369.             '  Show CapsLock or NumLk Keys or Insert or Out
  370.             '    in upper right corner
  371.             '    Save cursor position in case we move it
  372.             IF NOT OnEditPage AND NOT ClockScreen THEN
  373.                 CKey1 = Cl6f             ' CKey1 = foreground if key off
  374.                 CKey2 = Cl6b             ' CKey2 = background if key off
  375.               ELSEIF OnEditPage THEN
  376.                 IF ColorCRT THEN
  377.                     CKey1 = Cl6b
  378.                     CKey2 = Cl6f
  379.                   ELSE
  380.                     CKey1 = Cib
  381.                     CKey2 = Cif
  382.                 END IF
  383.               ELSEIF ClockScreen THEN
  384.                 CKey1 = Cl3f
  385.                 CKey2 = Cl3b
  386.             END IF
  387.             '    Get Placement For Cap,Num,Ins,Wait,TSR Info
  388.             IF StartupScreen OR OnEditPage OR OnOverduePage THEN
  389.                 PCRow = N1      ' Put Caps,Num,Ins, & Out at top of
  390.                 PCColumn = N64  '  startup screen
  391.                 PNRow = N1
  392.                 PNColumn = 67
  393.                 PIRow = N1
  394.                 PIColumn = 70
  395.                 PORow = N1
  396.                 POColumn = 73
  397.                 PRRow = N1
  398.                 PRColumn = 76
  399.               ELSEIF InHelp THEN
  400.                 PCRow = N22     ' Put Caps,Num,Ins, & Out at bottom center
  401.                 PCColumn = N27
  402.                 PNRow = N22
  403.                 PNColumn = 31
  404.                 PIRow = N22
  405.                 PIColumn = 35
  406.                 PORow = N22
  407.                 POColumn = N39
  408.                 PRRow = N22
  409.                 PRColumn = N43
  410.               ELSEIF ClockScreen AND ApptFile THEN
  411.                 PCRow = N11          ' Put Caps,Num,Ins, & Out over to left
  412.                 PCColumn = N1        '  for clock and appointment file
  413.                 PNRow = N12
  414.                 PNColumn = N1
  415.                 PIRow = N13
  416.                 PIColumn = N1
  417.                 PORow = N14
  418.                 POColumn = N1
  419.                 PRRow = N15
  420.                 PRColumn = N1
  421.               ELSEIF ClockScreen AND NOT ApptFile THEN
  422.                 PCRow = N1      ' Put Caps,Num,Ins, & Out in upper
  423.                 PCColumn = 77  '  right corner
  424.                 PNRow = N2
  425.                 PNColumn = 77
  426.                 PIRow = N3
  427.                 PIColumn = 77
  428.                 PORow = N4
  429.                 POColumn = 77
  430.                 PRRow = N5
  431.                 PRColumn = 77
  432.               ELSE
  433.                 PCRow = N3      ' Put Caps,Num,Ins, & Out at top of menu
  434.                 PCColumn = N64
  435.                 PNRow = N3
  436.                 PNColumn = 67
  437.                 PIRow = N3
  438.                 PIColumn = 70
  439.                 PORow = N3
  440.                 POColumn = 73
  441.                 PRRow = N3
  442.                 PRColumn = 76
  443.             END IF
  444.             '  Now Display CapsLock
  445.             IF Caps% <> CapsHold OR KeyFunction >= KeyTimerInit THEN
  446.                 CapsHold = Caps%
  447.                 IF Caps% THEN
  448.                     ColorForeground = CKey2
  449.                     ColorBackground = CKey1
  450.                     CALL Kolors(N0)
  451.                     CALL ShowIt(N0, PCRow, PCColumn, "Cap")
  452.                   ELSE
  453.                     ColorForeground = CKey1
  454.                     ColorBackground = CKey2
  455.                     CALL Kolors(N0)
  456.                     CALL ShowIt(N0, PCRow, PCColumn, ClearChar$)
  457.                 END IF
  458.             END IF
  459.             '  Now Display NumLock
  460.             IF Num% <> NumHold OR KeyFunction >= KeyTimerInit THEN
  461.                 NumHold = Num%
  462.                 IF Num% THEN
  463.                     ColorForeground = CKey2
  464.                     ColorBackground = CKey1
  465.                     CALL Kolors(N0)                     ' Special colors
  466.                     CALL ShowIt(N0, PNRow, PNColumn, "Num")
  467.                   ELSE
  468.                     ColorForeground = CKey1
  469.                     ColorBackground = CKey2
  470.                     CALL Kolors(N0)                     ' Special colors
  471.                     CALL ShowIt(N0, PNRow, PNColumn, ClearChar$)
  472.                 END IF
  473.             END IF
  474.             IF InsertHold <> Insrt% OR KeyFunction >= KeyTimerInit THEN
  475.                 InsertHold = Insrt%
  476.                 IF Insrt% = N1 THEN
  477.                     IF AllowInsertMode THEN
  478.                         ColorForeground = CKey2
  479.                         ColorBackground = CKey1
  480.                         CALL Kolors(N0)                ' Special colors
  481.                         CALL ShowIt(N0, PIRow, PIColumn, "Ins")
  482.                     END IF
  483.                   ELSE
  484.                     ColorForeground = CKey1
  485.                     ColorBackground = CKey2
  486.                     CALL Kolors(N0)                     ' Special colors
  487.                     CALL ShowIt(N0, PIRow, PIColumn, ClearChar$)
  488.                 END IF
  489.             END IF
  490.             IF MemoryResident <> ResHold OR KeyFunction >= KeyTimerInit THEN
  491.                 ResHold = MemoryResident
  492.                 IF MemoryResident THEN
  493.                     ColorForeground = CKey2
  494.                     ColorBackground = CKey1
  495.                     CALL Kolors(N0)                     ' Special colors
  496.                     CALL ShowIt(N0, PORow, POColumn, "TSR")
  497.                   ELSE
  498.                     ColorForeground = CKey1
  499.                     ColorBackground = CKey2
  500.                     CALL Kolors(N0)                     ' Special colors
  501.                     CALL ShowIt(N0, PORow, POColumn, ClearChar$)
  502.                 END IF
  503.             END IF
  504.             IF KeyDelayedExit = Yes OR KeyFunction >= KeyTimerInit OR _
  505.                PopWait <> PopWaitHold                             THEN
  506.                 PopWaitHold = PopWait
  507.                 IF KeyDelayedExit OR PopWait THEN
  508.                     ColorForeground = (CKey2 + N16) MOD N32' Blink
  509.                     ColorBackground = CKey1
  510.                     CALL Kolors(N0)                     ' Special colors
  511.                     CALL ShowIt(N0, PRRow, PRColumn, "Wait")
  512.                   ELSE
  513.                     ColorForeground = CKey1
  514.                     ColorBackground = CKey2
  515.                     CALL Kolors(N0)                     ' Special colors
  516.                     CALL ShowIt(N0, PRRow, PRColumn, _
  517.                         (Strng$(N4, ASC(ClearChar$))))
  518.                 END IF
  519.             END IF
  520.         END IF
  521.         '====================================================================
  522.         '  Update Timer Display If Not Suppressed
  523.         IF NOT TimerDisplaySuppress THEN
  524.             TimeNow$ = TIME$                        ' Save Time
  525.             IF KeyFunction = KeyTimerInit THEN
  526.                 CALL Kolors(N6)                     ' Forced Update
  527.                 CALL BoxDraw(N1, N1, N4, N1, N12)
  528.             END IF
  529.             IF TimeNow$ <> TimeHold$ OR KeyFunction = KeyTimerInit THEN
  530.                 TimeHold$ = TIME$
  531.                 CALL ShowIt(N6, N2, N2, DATE$)
  532.                 CALL ShowIt(N0, N3, N2, (Blank1$ + TIME$ + Blank1$))
  533.             END IF
  534.         END IF
  535.         '====================================================================
  536.         IF DebugRequested and LoopCounterShow THEN    'Debug Information
  537.             Tag$ = STR$(LoopCounter) + _
  538.                 STR$(MemoryLeft&) + STR$(MemoryOK&) + STR$(FRE(N0)) + _
  539.                 STR$(FRE(Nm1)) + STR$(FRE(Nm2)) + _
  540.                 STR$(CurrentStackSize&) + STR$(STACK) + SPACE$(N1)
  541.             CALL ShowIt(N6, N1, N30, Tag$)
  542.             Tag$ = STR$(FRE(Nm1) - _
  543.                   AvailableStringSpace&) + STR$(AvailableStringSpace&) + _
  544.                 STR$(KscanRes) + STR$(KshiftRes) + _
  545.                 STR$(ResEcode) + STR$(SrKscanHot) + STR$(SrKshiftHot) + _
  546.                 STR$(MemoryResident) + STR$(DOSCursorPage) + SPACE$(N1)
  547.             CALL ShowIt(N0, Nm1, N0, Tag$)
  548.         END IF
  549.         '====================================================================
  550.         '  Wait for Keystroke if Requested
  551.     LOOP WHILE LEN(Keystroke$) = N0 AND KeyFunction = KeyWait AND _
  552.              MenuRecursiveReturn = No           ' Not setting menu bypass
  553.     '=========================================================================
  554.     '  Exit Here with saved keystroke from either KeySingle or KeyWait
  555.     '   or if first pop down and menu refresh is needed.
  556.     '=========================================================================
  557.         Subnum = SubnumSave
  558.     END SUB
  559.     '=========================================================================
  560.     SUB KillAFile (KillFilename$) STATIC
  561.     '=========================================================================
  562.     '  Change Screen Color Setting
  563.     DEFINT A-Z
  564.         SubnumSave = Subnum
  565.         Subnum = 121
  566.     Filename$ = KillFilename$
  567.     CALL MhKill((ASCIIZ$(KillFilename$)), KillEcode%)
  568.         Subnum = SubnumSave
  569.     END SUB
  570.     '=========================================================================
  571.     SUB Kolors (KSetting) STATIC
  572.     '=========================================================================
  573.     '  Change Screen Color Setting
  574.     DEFINT A-Z
  575.         SubnumSave = Subnum
  576.         Subnum = 36
  577.     WhichSetting = KSetting
  578.     SELECT CASE WhichSetting
  579.         CASE 0                             ' Already Defined Color, use it
  580.         CASE N1                             ' Events
  581.             ColorForeground = Cl1f
  582.             ColorBackground = Cl1b
  583.         CASE N2                             ' Notes
  584.             ColorForeground = Cl2f
  585.             ColorBackground = Cl2b
  586.         CASE N3                             ' Clock
  587.             ColorForeground = Cl3f
  588.             ColorBackground = Cl3b
  589.         CASE N4                             ' Calendars
  590.             ColorForeground = Cl4f
  591.             ColorBackground = Cl4b
  592.         CASE N5                             ' Menus
  593.             ColorForeground = Cl5f
  594.             ColorBackground = Cl5b
  595.         CASE N6                             ' Instructions
  596.             ColorForeground = Cl6f
  597.             ColorBackground = Cl6b
  598.         CASE N7                             ' Emphasis
  599.             ColorForeground = Chf
  600.             ColorBackground = Chb
  601.         CASE N8                        ' 8 to 14 are inverse of 1 to 7
  602.             ColorForeground = Cl1b
  603.             ColorBackground = Cl1f
  604.         CASE N9
  605.             ColorForeground = Cl2b
  606.             ColorBackground = Cl2f
  607.         CASE N10
  608.             ColorForeground = Cl3b
  609.             ColorBackground = Cl3f
  610.         CASE N11
  611.             ColorForeground = Cl4b
  612.             ColorBackground = Cl4f
  613.         CASE N12
  614.             ColorForeground = Cl5b
  615.             ColorBackground = Cl5f
  616.         CASE N13
  617.             ColorForeground = Cl6b
  618.             ColorBackground = Cl6f
  619.         CASE N14
  620.             IF ColorCRT THEN
  621.                 ColorForeground = Chb
  622.                 ColorBackground = Chf
  623.               ELSE
  624.                 ColorForeground = Cib
  625.                 ColorBackground = Cif
  626.             END IF
  627.         CASE N15                            ' Inverse and Blinking
  628.             ColorForeground = Cl6b + N16
  629.             ColorBackground = Cl6f
  630.         CASE N16                            ' Bright Inverse and Blinking
  631.             IF ColorCRT THEN
  632.                 ColorForeground = Chb + N16
  633.                 ColorBackground = Chf
  634.               ELSE
  635.                 ColorForeground = Cib + N16
  636.                 ColorBackground = Cif
  637.             END IF
  638.         CASE N17                            ' White on Black
  639.             ColorForeground = N7
  640.             ColorBackground = N0
  641.         CASE N18                            ' Black on White
  642.             ColorForeground = N0
  643.             ColorBackground = N7
  644.         CASE N19                                 ' 13 If Not Mono
  645.             IF ColorCRT THEN
  646.                 ColorForeground = Cl6b
  647.                 ColorBackground = Cl6f
  648.               ELSE
  649.                 ColorForeground = Cib
  650.                 ColorBackground = Cif
  651.             END IF
  652.         CASE N20                            ' Hilit and Blinking
  653.             ColorForeground = Chf + N16
  654.             ColorBackground = Chb
  655.         CASE N99                            ' DOS Colors
  656.             ColorForeground = DOSForeground
  657.             ColorBackground = DOSBackground
  658.     END SELECT
  659.     '  The only use of the BASIC "Color" statement is here! --
  660.     COLOR ColorForeground, (ColorBackground MOD N8)
  661.     '  So that the Current Color Attribute can be computed for the Mh routines
  662.     MhColorForeground = ColorForeground
  663.     MhColorBackground = ColorBackground
  664.     CALL MhColorAttribute(MhCAttribute%, MhColorForeground%, _
  665.         (MhColorBackground% MOD N8%))                   ' >7 like QB can
  666.     ColorAttribute = MhCAttribute
  667.         Subnum = SubnumSave
  668.     END SUB
  669.     '=========================================================================
  670.     FUNCTION Leap (LeapInput) STATIC
  671.     '=========================================================================
  672.     '   Check If Date Is Leap Year (Leap); Does Not Include 4000 yr Anomaly!
  673.     DEFINT A-Z
  674.         SubnumSave = Subnum
  675.         Subnum = 37
  676.     Leap = N0
  677.     IF (LeapInput MOD 4) = N0 THEN
  678.         IF (LeapInput MOD 100) = N0 THEN
  679.             IF (LeapInput MOD 400) THEN GOTO ExitPoint
  680.         END IF
  681.         Leap = N1
  682.     END IF
  683.     '           Count
  684. ExitPoint:
  685.         Subnum = SubnumSave
  686.     END FUNCTION
  687.     '=========================================================================
  688.     SUB LprintString (PrintString$, HoldPrint)        'CAN'T BE STATIC !!
  689.     '=========================================================================
  690.     '  Send to Printer With Friendly Error Recovery and Paging
  691.     '    PrintString$ is what to print
  692.     '    HoldPrint Means Don't Space a Line
  693.     '  This routine is recursive if it ejects a page in the middle of
  694.     '   processing an error or page break
  695.     DEFINT A-Z
  696.         SubnumSave = Subnum
  697.         Subnum = 38
  698.     IF LprintJobOver THEN
  699.         LprintJobOver = No
  700.         OPEN "O", #FilenumCopy, "LPT1"        'Flush printer at end
  701.         CLOSE #FilenumCopy
  702.         GOTO ExitPoint2
  703.     END IF
  704.     IF LprintTerminate THEN GOTO ExitPoint2        'If existing error, out
  705.     Lin$ = PrintString$                        'Get string to print
  706.     IF HoldPrint <> N1 THEN                    'If a full line,
  707.         Lin$ = Lin$ + CHR$(N13) + CHR$(N10)        '  add a carriage return
  708.     END IF
  709. PrintTheLine:
  710.     CALL MhLprint (N1%, Lin$, CharsPrinted%, LprintEcode%) 'Print it
  711.     IF LprintEcode = N0 THEN                             ' If okay and
  712.         IF PrinterLineLimit THEN                         '  If limited
  713.             IF PrinterLineCount > PrinterLineLimit THEN     '    If at limit
  714.                 '----------------------------------------
  715.                 'This call makes this routine recursive
  716.                 '  but the recursion will cause an exit
  717.                 '  because PrinterLineCount is reset 1st
  718.                 CALL PageEject                         '     eject page
  719.                 '----------------------------------------
  720.                 IF PrinterPause$ = True$ THEN             '     If pausing
  721.                     GOSUB ProcessErrorOrPage             '       do pause
  722.                 END IF
  723.               ELSE
  724.                 PrinterLineCount = PrinterLineCount + 1     '    bump count
  725.             END IF
  726.         END IF
  727.         GOTO ExitPoint2                                ' else out
  728.       ELSE
  729.         GOSUB ProcessErrorOrPage                'If not okay, give error
  730.         IF GetOut THEN    
  731.             GOTO ExitPoint2                ' User wanted out
  732.           ELSE
  733.             GOTO PrintTheLine                ' User wants to retry
  734.         END IF
  735.     END IF
  736.     '=========================================================================
  737.     '  Control never passes through here
  738.     '=========================================================================
  739. ProcessErrorOrPage:
  740.     GetOut = No
  741.     '  Error or Page Break Has Occurred--Find a Place for the Message
  742.     IF InHelp THEN 
  743.         CALL Kolors(N6)
  744.         CALL ClearLast4
  745.     END IF
  746.     MsgRow = N25
  747.     CALL Kolors(N16)               ' Bright and Blinking
  748.     IF LprintEcode THEN
  749.         CALL MajorBeeper
  750.         EraseLine$ = _
  751.   "A Printer Error Has Occurred -- 'Esc' Terminates Print; Other Key Continues"
  752.       ELSE
  753.         CALL MinorBeeper
  754.         EraseLine$ = _
  755.      "End of Page; Change Paper -- 'Esc' Terminates Print; Other Key Continues"
  756.     END IF
  757.     CALL ShowErase(N0, MsgRow, N1, N80, EraseLine$)
  758.     CALL KeyStuff(KeyWait)
  759.     IF ClockScreen THEN
  760.         FooterRecall = Yes
  761.         FooterAction$ = Blank1$
  762.         RedisplayNotesEvents = Yes
  763.         RefreshInstructions = Yes
  764.     END IF
  765.     IF Keystroke$ = CHR$(Esc) THEN 
  766.         LprintTerminate = Yes
  767.         PrinterLineCount = 1
  768.         GetOut = Yes
  769.         RETURN
  770.       ELSE
  771.         LprintTerminate = No
  772.         CALL MinorBeeper
  773.         CALL ShowErase(N16, MsgRow, N1, N80, _
  774.             (SPACE$(33) + "Resuming Print"))
  775.     END IF
  776.     IF CharsPrinted < LEN(Lin$) THEN
  777.         Lin$ = RIGHT$(Lin$, LEN(Lin$) - CharsPrinted)
  778.         GetOut = No
  779.     END IF
  780.     RETURN
  781. ExitPoint2:
  782.         Subnum = SubnumSave
  783.     END SUB
  784.     '=========================================================================
  785.     SUB MajorBeeper STATIC
  786.     '=========================================================================
  787.     '   MajorBeeper -- Beeps only if sound has been allowed
  788.     DEFINT A-Z
  789.         SubnumSave = Subnum
  790.         Subnum = 39
  791.     IF SoundLevel > N1 THEN
  792.         CALL PlayStuff("mbt255l13mlo4e-dcl9go3l5g")
  793.     END IF
  794.         Subnum = SubnumSave
  795.     END SUB
  796.     '=========================================================================
  797.     SUB MenuDriver (MMenuSize, MMenuChoice, MMenuRow, MReqMenuColumn, _
  798.       MMenuSingleLine, MMenuSpecialExit, MScreenBottomsShow, _
  799.       MFilenameShow)  STATIC
  800.     '=========================================================================
  801.     '   Menu Processor
  802.     DEFINT A-Z
  803.         SubnumSave = Subnum
  804.         Subnum = 40
  805.     '--------------------------------------------------------------------
  806.     '     Menu Call
  807.     ' MenuSpecialExit               Allow Special Function Keys
  808.     ' MenuChoice  Menu Choice     MenuExit  Cancel/Prompt
  809.     ' MenuRow,MenuColumn          Placement Of Menu
  810.     '   ReqMenuColumn is -1 if auto-center requested, Else is MenuColumn
  811.     ' MenuSize                   Number of Menu Items
  812.     '-------------------------------------------------------------------------
  813.     MenuSize = MMenuSize
  814.     MenuChoice = MMenuChoice
  815.     MenuRow = MMenuRow
  816.     ReqMenuColumn = MReqMenuColumn
  817.     MenuSingleLine =  MMenuSingleLine
  818.     MenuSpecialExit = MMenuSpecialExit
  819.     ScreenBottomsShow = MScreenBottomsShow
  820.     FilenameShow = MFilenameShow
  821. StartMenu:
  822.     InMenu = Yes
  823.     IF FilenameShow THEN CALL DisplayApptFilename
  824.     IF ScreenBottomsShow THEN CALL ScreenBottoms
  825.     CALL KeyStuff(KeyStatusAbs)
  826.     MenuExit = MenuNormalExit
  827.     IF ReqMenuColumn = Nm1 THEN
  828.         MenuCenter = N1
  829.         MenuColumn = N1
  830.       ELSE
  831.         MenuCenter = N0
  832.         MenuColumn = ReqMenuColumn
  833.     END IF
  834.     IF MenuChoice < N1 OR MenuChoice > MenuSize THEN 
  835.         MenuChoice = N1                ' Out of bounds
  836.     END IF
  837.     '  Acceptance Block
  838.     IF ColorCRT THEN
  839.           MenuColorFore = Cl5f
  840.           MenuColorBack = Cl5b
  841.         ELSE
  842.           MenuColorFore = Cl1f
  843.           MenuColorBack = Cl1b
  844.     END IF
  845.     MenuChoiceInit = MenuChoice
  846.     '-------------------------------------------------------------------------
  847. SetMenuLine:
  848.     IF NOT MenuSingleLine THEN
  849.         ThisMenuLine = N1
  850.         MenuChoice = N1
  851.       ELSE
  852.         ThisMenuLine = MenuChoice
  853.     END IF
  854.     '-------------------------------------------------------------------------
  855.     '  Find Width of Menu for Box and Automatic Filling
  856.     IF NOT MenuSingleLine THEN
  857.         IF EditingNotes THEN            ' 75 wide for notes/history
  858.             MenuWidth = N75
  859.           ELSEIF EditingEvents THEN        ' 80 wide for events
  860.             MenuWidth = N80
  861.           ELSE                        ' variable for everything else
  862.             MenuWidth = N0
  863.             FOR J = N1 TO MenuSize
  864.                 CALL MhNotBackwardInstr(Pointer%, N1%, (MenuLines(J)), N32%)
  865.                 IF Pointer > MenuWidth THEN
  866.                     MenuWidth = Pointer
  867.                 END IF
  868.             NEXT
  869.         END IF
  870.     END IF
  871.     '  Automatic Menu Centering If Requested (Adjusted for Spaces)
  872.     IF MenuCenter THEN MenuColumn = N1 + (76 - MenuWidth) \ N2
  873.     '=========================================================================
  874.     '  Loop Through Acceptance Shells and Menu Descriptions
  875.     DO
  876.         IF WhichColor <> N0 AND ColorCRT THEN
  877.             '  Special Color Effects; Set Color to Show
  878.             FOR JJJ = N1 TO MenuSize
  879.                 IF LEFT$(MenuLines(ThisMenuLine), _
  880.                         LEN(Colors$(JJJ))) = Colors$(JJJ) THEN
  881.                     ColortoShow = JJJ - N1
  882.                 END IF
  883.             NEXT
  884.             IF (WhichColor MOD N2) = N1 THEN
  885.                 MenuColorFore = ColortoShow
  886.               ELSE
  887.                 MenuColorBack = ColortoShow
  888.             END IF
  889.             SELECT CASE WhichColor
  890.                 CASE N1
  891.                     MenuColorBack = Cl1b
  892.                 CASE N2
  893.                     MenuColorFore = Cl1f
  894.                 CASE N3
  895.                     MenuColorBack = Cl2b
  896.                 CASE N4
  897.                     MenuColorFore = Cl2f
  898.                 CASE N5
  899.                     MenuColorBack = Cl3b
  900.                 CASE N6
  901.                     MenuColorFore = Cl3f
  902.                 CASE N7
  903.                     MenuColorBack = Cl4b
  904.                 CASE N8
  905.                     MenuColorFore = Cl4f
  906.                 CASE N9
  907.                     MenuColorBack = Cl5b
  908.                 CASE N10
  909.                     MenuColorFore = Cl5f
  910.                 CASE N11
  911.                     MenuColorBack = Cl6b
  912.                 CASE N12
  913.                     MenuColorFore = Cl6f
  914.                 CASE N13
  915.                     MenuColorBack = Chb
  916.                 CASE N14
  917.                     MenuColorFore = Chf
  918.             END SELECT
  919.             '---------------------------------------------------------------
  920.             '  Handle Invisibles As Black and White, Regardless of Color
  921.             IF MenuColorFore = MenuColorBack OR _
  922.                LEFT$(MenuLines(ThisMenuLine), N1) = "<" THEN
  923.                 MenuColorFore = N7
  924.                 MenuColorBack = N0
  925.                 '----------------------------------------------------------
  926.                 '  If The Carets are not There, Add Them To the Ends
  927.                 IF LEFT$(MenuLines(ThisMenuLine), N1) <> "<" THEN
  928.                     CALL MhNotBackwardInstr(Pointer%, N1%, _
  929.                         (MenuLines(ThisMenuLine)), N32%)
  930.                     MenuLines(ThisMenuLine) = "<" + _
  931.                         LEFT$(MenuLines(ThisMenuLine), Pointer) + ">"
  932.                 END IF
  933.                 '----------------------------------------------------------
  934.                 '  If Adding the Carets Increases Width,
  935.                 '   Start The List Over Again
  936.                 CALL MhNotBackwardInstr(Pointer%, N1%, _
  937.                     (MenuLines(ThisMenuLine)), N32%)
  938.                 IF Pointer > MenuWidth AND MenuSingleLine = No THEN
  939.                     MenuWidth = Pointer
  940.                     GOTO SetMenuLine
  941.                 END IF
  942.                 '----------------------------------------------------------
  943.             END IF
  944.         END IF
  945.         '--------------------------------------------------------------------
  946.         ColorForeground = MenuColorFore              ' Fill Menu Colors
  947.         ColorBackground = MenuColorBack              '  Array (Normals)
  948.         CALL Kolors(N0)
  949.         MenuColors(ThisMenuLine) = ColorAttribute
  950.         '====================================================================
  951.         ' Put Box Around Menu if First Time, Not Too Big, or Not Clock or Edit
  952.         '  If returning recursively, compute values but do not draw
  953.         IF (ThisMenuLine = N1 AND MenuSingleLine = No) OR _
  954.             MenuRecursiveReturn = Yes                     THEN
  955.             IF NOT ClockScreen AND NOT OnEditPage THEN
  956.                 IF MenuWidth > 76 THEN
  957.                     BoxWidth = MenuWidth
  958.                     BoxType = N0
  959.                     BoxX1 = MenuColumn + N1
  960.                     BoxX2 = BoxX1 + BoxWidth - N1
  961.                     BoxY1 = MenuRow + N1
  962.                     BoxY2 = MenuRow + MenuSize
  963.                     MenuFiller$ = Blank0$
  964.                   ELSE
  965.                     BoxWidth = N2 + MenuWidth
  966.                     BoxType = N2
  967.                     BoxX1 = MenuColumn
  968.                     BoxX2 = BoxX1 + BoxWidth + N1
  969.                     BoxY1 = MenuRow
  970.                     BoxY2 = MenuRow + MenuSize + N1
  971.                     MenuFiller$ = Blank1$
  972.                 END IF
  973.                 IF NOT MenuRecursiveReturn THEN
  974.                     ColorAttribute = MenuColors(N1)
  975.                     ' Right Column
  976.                     CALL BoxDraw(BoxType, BoxY1, BoxY2, BoxX1, BoxX2) 
  977.                 END IF
  978.                 EntryWidth = BoxWidth
  979.               ELSE
  980.                 EntryWidth = MenuWidth
  981.                 MenuFiller$ = Blank0$
  982.             END IF
  983.         END IF
  984.         '====================================================================
  985.         MenuChoice = ThisMenuLine
  986.         GOSUB NormalLineShow         ' Paint Current Line Normal Color
  987.         IF MenuSingleLine THEN EXIT DO
  988.         '====================================================================
  989.         IF ThisMenuLine < MenuSize THEN
  990.             ThisMenuLine = ThisMenuLine + N1
  991.           ELSE
  992.             EXIT DO
  993.         END IF
  994.     LOOP
  995.     MenuChoice = MenuChoiceInit        ' Restore Current Menu Choice
  996.     '=========================================================================
  997. WriteMenuLine:
  998.     GOSUB HilitLineShow       '  Write the Current Line in the hilit color
  999.     '=========================================================================
  1000.     ' MenuDriver is recursive because of the one use made by StayResOptions.
  1001.     '    StayResPopDown causes StayResOptions to clobber another menu
  1002.     '    prematurely.  Values are restored and control is returned here to
  1003.     '    begin anew.  Actual menu repainting is bypassed because screen was
  1004.     '    already restored by the call to WindowRestore
  1005.     '  Accept a Keystroke.  Recursive return won't give us one.  We refresh
  1006.     '    the menu variables and come back here to try again
  1007. RecursiveReturnPoint:
  1008.     MenuRecursiveReturn = No           '  If pop down occurs here and it's
  1009.     InMenuSave = No
  1010.     CALL KeyStuff(KeyWait)             '   the first ever, return switch is
  1011.     IF MenuRecursiveReturn THEN GOTO StartMenu
  1012.                                 '   set, but no keystroke is returned.
  1013.     SELECT CASE LEN(Keystroke$)
  1014.         CASE N1                        ' Length 1 Keys (Enter,Esc,Bsp,Space)
  1015.             '===============================================================
  1016.             SELECT CASE InString(CHR$(Enter) + CHR$(Esc) + CHR$(Bsp) + _
  1017.                     Blank1$, Keystroke$)
  1018.                 CASE N1                   '  Enter
  1019.                     GOTO SpecialClear
  1020.                 CASE N2                   '  Escape
  1021.                     GOTO MenuOut
  1022.                 CASE N3                   '  Backspace (also Up-Arrow)
  1023. BackspaceKey:
  1024.                     GOSUB NormalLineShow          '  Reprint Line Normal
  1025.                     MenuChoice = MenuChoice - N1
  1026.                     IF MenuChoice = N0 THEN MenuChoice = MenuSize
  1027.                 CASE N4                   '  Space (also Down-Arrow)
  1028. SpaceBar:
  1029.                     GOSUB NormalLineShow
  1030.                     MenuChoice = MenuChoice + N1
  1031.                     IF MenuChoice > MenuSize THEN MenuChoice = N1
  1032.                 CASE ELSE                '  Other Length One Keys
  1033.                     FOR TestCounter = N1 TO MenuSize
  1034.                         '  Test Against Menu First Characters
  1035.                         TestPosition = MenuChoice + TestCounter
  1036.                         IF TestPosition > MenuSize THEN 
  1037.                             TestPosition = MenuChoice + TestCounter - _
  1038.                                 MenuSize
  1039.                         END IF
  1040.                         '  First Increment Position
  1041.                         MenuCharTest$ = LEFT$(MenuLines(TestPosition), _
  1042.                                         N1)
  1043.                         '  Test Character Save
  1044.                         IF MenuCharTest$ >= "A" AND MenuCharTest$ _
  1045.                            <= "Z"                             THEN
  1046.                             '  Test Against Upper Case/Lower
  1047.                             IF Keystroke$ = MenuCharTest$ OR _
  1048.                                Keystroke$ = CHR$(ASC(MenuCharTest$) + _
  1049.                                N32)                     THEN 
  1050.                                 GOTO ReprintLine 
  1051.                               ELSE 
  1052.                                 GOTO AnotherChar
  1053.                             END IF
  1054.                             '  Test Against Upper
  1055.                         END IF
  1056.                         IF MenuCharTest$ >= "a" AND _
  1057.                            MenuCharTest$ <= "z" THEN
  1058.                             '  Test Against Lower
  1059.                             IF Keystroke$ = MenuCharTest$ OR _
  1060.                                Keystroke$ = CHR$(ASC(MenuCharTest$) _
  1061.                                 - N32) THEN 
  1062.                                 GOTO ReprintLine 
  1063.                                 ELSE 
  1064.                                 GOTO AnotherChar
  1065.                             END IF
  1066.                         END IF
  1067.                         IF Keystroke$ = MenuCharTest$ THEN
  1068.                             GOTO ReprintLine
  1069.                         END IF
  1070.                         '           Against Any Other
  1071. AnotherChar:
  1072.                     NEXT
  1073. FinishedChars:
  1074.                     CALL MinorBeeper
  1075.                     GOTO RecursiveReturnPoint
  1076. ReprintLine:
  1077.                     GOSUB NormalLineShow      ' Reprint Line Normal
  1078.                     MenuChoice = TestPosition
  1079.                     GOTO WriteMenuLine
  1080.             END SELECT
  1081.             GOTO WriteMenuLine
  1082.         CASE N2                        ' Length 2 Keys
  1083.             SELECT CASE InString(CHR$(PgUp) + CHR$(PgDn) + CHR$(F2) + _
  1084.                            CHR$(North) + CHR$(South) + CHR$(Ins) + _
  1085.                            CHR$(Del) + CHR$(HomeKey) + CHR$(EndKey), _
  1086.                     RIGHT$(Keystroke$, N1))
  1087.                 CASE N1                   ' Page Up
  1088.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1089.                         CALL MinorBeeper
  1090.                         GOTO RecursiveReturnPoint
  1091.                     END IF
  1092.                     MenuSpecialExit = SpecialExitPgUp
  1093.                     GOTO AllOver2
  1094.                 CASE N2                   ' Page Down
  1095.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1096.                         CALL MinorBeeper
  1097.                         GOTO RecursiveReturnPoint
  1098.                     END IF
  1099.                     MenuSpecialExit = SpecialExitPgDn
  1100.                     GOTO AllOver2
  1101.                 CASE N3                   ' F2
  1102.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1103.                         CALL MinorBeeper
  1104.                         GOTO RecursiveReturnPoint
  1105.                     END IF
  1106.                     MenuSpecialExit = SpecialExitF2
  1107.                     GOTO AllOver2
  1108.                 CASE N4                   ' North
  1109.                     GOTO BackspaceKey
  1110.                 CASE N5                   ' South
  1111.                     GOTO SpaceBar
  1112.                 CASE N6                   ' Insert Key
  1113.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1114.                         CALL MinorBeeper
  1115.                         GOTO RecursiveReturnPoint
  1116.                     END IF
  1117.                     MenuSpecialExit = SpecialExitInsert
  1118.                     GOTO AllOver2
  1119.                 CASE 7                   ' Delete
  1120.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1121.                         CALL MinorBeeper
  1122.                         GOTO RecursiveReturnPoint
  1123.                     END IF
  1124.                     MenuSpecialExit = SpecialExitDelete
  1125.                     GOTO AllOver2
  1126.                 CASE N8                   ' Home
  1127.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1128.                         CALL MinorBeeper
  1129.                         GOTO RecursiveReturnPoint
  1130.                     END IF
  1131.                     MenuSpecialExit = SpecialExitHomeKey
  1132.                     GOTO AllOver2
  1133.                 CASE N9                   ' End
  1134.                     IF MenuSpecialExit = SpecialExitDisallowed THEN
  1135.                         CALL MinorBeeper
  1136.                         GOTO RecursiveReturnPoint
  1137.                     END IF
  1138.                     MenuSpecialExit = SpecialExitEndKey
  1139.                     GOTO AllOver2
  1140.                 CASE ELSE
  1141.                     GOTO FinishedChars
  1142.             END SELECT
  1143.     END SELECT
  1144.     '-------------------------------------------------------------------------
  1145. MenuOut:
  1146.     MenuExit = MenuCancelled           '  Esc Key
  1147.     '  Enter or Escape Goes Here
  1148.     '-------------------------------------------------------------------------
  1149.     '  Clear Special Exit
  1150. SpecialClear:
  1151.     MenuSpecialExit = MenuNormalExit
  1152.     '-------------------------------------------------------------------------
  1153.     '  Exit From Menu
  1154. AllOver2:
  1155.     GOSUB NormalLineShow                         ' Lowlight Last Entry
  1156.     IF ScreenBottomsShow THEN CALL ScreenBottomsDelete
  1157.     InMenu = No
  1158.     GOTO ExitPoint3
  1159.     '-------------------------------------------------------------------------
  1160.     ' Print Current Line Normal Color
  1161. NormalLineShow:
  1162.     ColorAttribute = MenuColors(MenuChoice)
  1163.     CALL ShowErase(N0, (MenuRow + MenuChoice), (N1 + MenuColumn), _
  1164.         EntryWidth, (MenuFiller$ + LEFT$(MenuLines(MenuChoice), MenuWidth) + _
  1165.         MenuFiller$))
  1166.     RETURN
  1167.     '-------------------------------------------------------------------------
  1168.     ' Print Current Line Hilit -- Various Solutions to This!
  1169. HilitLineShow:
  1170.     IF MonoCRT AND NOT OnEditPage THEN      ' Mono hilit
  1171.         CALL Kolors(N14)                                   '  other than edit
  1172.       ELSE
  1173.         ColorAttribute = MenuColors(MenuChoice)
  1174.         CALL ColorDecode(ColorAttribute)
  1175.         IF ColorForeground = ColorBackground THEN         '  Invisibles
  1176.             CALL Kolors(N16)                              '  Black on White
  1177.           ELSEIF WhichColor <> N0 AND ColorCRT THEN   ' Specials Blink
  1178.             ColorForeground = (ColorForeground MOD N16) + N16'on current line
  1179.             CALL Kolors(N0)
  1180.           ELSE
  1181.             SWAP ColorForeground, ColorBackground        ' All Others
  1182.             CALL Kolors(N0)                               '  reverse
  1183.         END IF
  1184.     END IF
  1185.     CALL ShowErase(N0, (MenuRow + MenuChoice), (N1 + MenuColumn), _
  1186.         EntryWidth, (MenuFiller$ + LEFT$(MenuLines(MenuChoice), MenuWidth)))
  1187.     RETURN
  1188. ExitPoint3:
  1189.     MMenuChoice = MenuChoice
  1190.     MMenuSpecialExit = MenuSpecialExit
  1191.         Subnum = SubnumSave
  1192.     END SUB
  1193.     '=========================================================================
  1194.     SUB MinorBeeper STATIC
  1195.     '=========================================================================
  1196.     '   MinorBeeper -- Beeps only if sound has been allowed
  1197.     DEFINT A-Z
  1198.         SubnumSave = Subnum
  1199.         Subnum = 41
  1200.     IF SoundLevel > N1 THEN
  1201.         CALL PlayStuff("mbt255l14o3mlbec#")
  1202.     END IF
  1203.         Subnum = SubnumSave
  1204.     END SUB
  1205.     '=========================================================================
  1206.     SUB MoveApptRecords (FileStart, MoveStart, MoveEnd, MoveIncr, _
  1207.         MoveOrigin, MoveTarget, MoveFlag, BlankFlag, BlankAt) STATIC
  1208.     '=========================================================================
  1209.     'Routine To Move Records Up Or Down In File A Fixed Amount
  1210.     '   (MoveOrigin to MoveTarget from FileStart
  1211.     '     Backwards or Forwards (MoveIncr)
  1212.     '     Starting From MoveStart, Ending With MoveEnd
  1213.     DEFINT A-Z
  1214.         SubnumSave = Subnum
  1215.         Subnum = 42
  1216.     CALL ShowErase(N14, N25, N1, N80, _
  1217.         "       Please Wait--Moving Records in Appointment File")
  1218.     FOR Mover = MoveStart TO MoveEnd STEP MoveIncr
  1219.         CALL KeyStuff(KeyStatus)
  1220.         MovSt = ABS(MoveEnd - Mover + N1)
  1221.         CALL ShowIt(N14, N25, N60, (STR$(MovSt) + SPACE$(N4)))
  1222.         MovePoint = FileStart + Mover - N1
  1223.         ' MoveFlag Must Be 1 to Copy Record To New Location
  1224.         IF MoveFlag = N1 THEN
  1225.             CALL GetApptRecord(MovePoint + MoveOrigin)
  1226.             CALL PutApptRecord(MovePoint + MoveTarget)
  1227.         END IF
  1228.         '   BlankFlag Must Be 1 to Blank BlankAt Location
  1229.         IF BlankFlag = N1 THEN
  1230.             CALL MhLset(ApptBuffer$, Blank80$)
  1231.             CALL PutApptRecord(MovePoint + BlankAt)
  1232.         END IF
  1233.     NEXT
  1234.         Subnum = SubnumSave
  1235.     END SUB
  1236.     '=========================================================================
  1237.     SUB Myd2 (Destin$, DestinStart%, Chars%, Source$)  STATIC
  1238.     '=========================================================================
  1239.     '   Replacement for MID$ Statement--whole source to partial destination
  1240.     DEFINT A-Z
  1241.         SubnumSave = Subnum
  1242.         Subnum = 122
  1243.     '  Doesn't define output string length
  1244.     CALL MhMidString (Destin$, DestinStart%, Chars%, Source$, N1%)
  1245.         Subnum = SubnumSave
  1246.     END SUB
  1247.     '=========================================================================
  1248.     SUB NotesHistory (NotesorHistory$) STATIC
  1249.     '=========================================================================
  1250.     '   Process History Or Note Editing Request
  1251.     DEFINT A-Z
  1252.         SubnumSave = Subnum
  1253.         Subnum = 43
  1254.     'History/Note Variables- LastRecord     Last Relative Record
  1255.     '(2 for notes)           LastPage       Last Relative Page
  1256.     '                                                  (starting with 0)
  1257.     '(1 to end)              CurrentHistory         Current Relative
  1258.     '                                                  History Record
  1259.     '(1 to NumberofNotes)  CurrentNote            Current Relative
  1260.     '                                                  Note Record
  1261.     '(1 to end)              CurrentNoteHist        Current Relative Record
  1262.     '(page has 20 recs)      CurrentPage   Current Relative Page
  1263.     '                                                  (0 on)
  1264.     '(1 to end)              ApptFileRec   Current Absolute
  1265.     '                                                  Record Number In File
  1266.     '(StartingNote or StartingHistory)   FileStart
  1267.     '                                 Starting Absolute Record Number In File
  1268.     '( 62 Default)           StartingNote           Starting Absolute
  1269.     '                                                  Note Record Number
  1270.     '(122 Default)           StartingHistory        Starting Absolute
  1271.     '                                                  History Record Number
  1272.     '                        NotesorHistory$       ("N") or ("H")
  1273.     '-------------------------------------------------------------------------
  1274.     '     Initialize parameters, Display History Only If Some Is There
  1275. StartAll:
  1276.     ExitKeys = Yes
  1277.     GOSUB SetupNotes
  1278.     IF NotesorHistory$ = "H" AND LOF(FilenumAppt) \ N80 < StartingHistory THEN
  1279.         CALL MinorBeeper
  1280.         Menu1 = MainMenuLastEntry
  1281.         GOTO ExitPoint4
  1282.     END IF
  1283.     MenuSingleLine = No
  1284.     IF NOT OnScreen THEN
  1285.         MenuRow = N1
  1286.         CALL Kolors(N5)
  1287.         TimerDisplaySuppress = Yes
  1288.         CLS
  1289.         OnEditPage = Yes
  1290.         ClockScreen = No
  1291.         CALL ShowErase(N19, N1, N6, N75, "Change ")
  1292.         IF NotesorHistory$ = "H" THEN
  1293.             CALL ShowIt(N0, N0, Nm1, "History")
  1294.           ELSE
  1295.             CALL ShowIt(N0, N0, Nm1, "Notes")
  1296.         END IF
  1297.       ELSE
  1298.         MenuRow = N17
  1299.         IF FooterSize >= N6 THEN
  1300.             CALL ShowIt(N3, F5HelpRow, N1, Blank8$)        ' Clear F5 Prompt
  1301.         END IF
  1302.         CALL ShowIt(N3, N17, N1, Blank80$)         ' Clear Row Above Edit
  1303.     END IF
  1304.     '-------------------------------------------------------------------------
  1305.     '     Fill a Menu's Worth of History or Notes
  1306.     FOR JJ = N1 TO EditPagesize
  1307.         CALL KeyStuff(KeyStatus)
  1308.         IF (EditPagesize * CurrentPage + JJ) > LastRecord THEN EXIT FOR
  1309.         JT = JJ
  1310.         ' Get Note/History Number and Right Justify It
  1311.         EditLineLabel$ = STR$(JJ + EditPagesize * CurrentPage)
  1312.         LenTemp = LEN(EditLineLabel$) - N1  ' Less the leading space
  1313.         IF LenTemp > N4 THEN LenTemp = N4    ' Only the right 4 chars
  1314.         EditLineLabel$ = SPACE$(N4 - LenTemp) + _
  1315.             RIGHT$(EditLineLabel$, LenTemp) + Blank1$
  1316.         CALL ShowIt(N13, (MenuRow + JJ), N1, EditLineLabel$)
  1317.         ' Get Note or History Text
  1318.         ApptFileRec = FileStart + JJ + EditPagesize * CurrentPage - N1
  1319.         CALL GetApptRecord(ApptFileRec)
  1320.         '--------------------------------------------------------------------
  1321.         '     Each Entry Is Filled Or Nulled
  1322.         MenuLines(JJ) = MID$(ApptBuffer$, N1, N75)
  1323.     NEXT
  1324.     MenuSize = JT
  1325.     '-------------------------------------------------------------------------
  1326.     '     Set Up For Editing--Back To Clock When Finished
  1327. StartEdit:
  1328.     ExitKeys = Yes
  1329.     IF NOT OnScreen OR OnScreenFirst THEN
  1330.         FOR I = N1 TO N4
  1331.             CALL ShowIt(N14, N21 + I, N1, NoteInstructions1(I))
  1332.         NEXT
  1333.         FOR I = N1 TO N3
  1334.             CALL ShowIt(N9, N22 + I, N28, NoteInstructions2(I))
  1335.         NEXT
  1336.         CALL ShowIt(N0, N22, N0, NoteInstructions3)
  1337.         FOR I = N1 TO N3
  1338.             CALL ShowIt(N19, N22 + I, N50, EventNoteSharedIns(I))
  1339.         NEXT
  1340.         OnScreenFirst = No
  1341.     END IF
  1342.     MenuSpecialExit = SpecialExitAllowed
  1343.     MenuChoice = CurrentNoteHist - (EditPagesize * CurrentPage)
  1344.     EditingNotes = Yes
  1345.     CALL MenuDriver(MenuSize, MenuChoice, MenuRow, N5, _
  1346.         MenuSingleLine, MenuSpecialExit, N0, N0)
  1347.     EditingNotes = No
  1348.     IF MenuExit = MenuCancelled THEN
  1349.         IF OnScreen THEN
  1350.             ScreenMultRow = MenuRow + N1
  1351.             CALL ShowMult(N3, ScreenMultRow, N1, N80, N8)
  1352.             RefreshInstructions = Yes
  1353.             RedisplayNotesEvents = Yes
  1354.           ELSEIF NotesorHistory$ = "N" THEN
  1355.             CurrentNote = N1
  1356.         END IF
  1357.         NoHistEndDefault = No
  1358.         MenuSingleLine = No
  1359.         Menu1 = MainMenuLastEntry
  1360.         ' Flush I/O Buffers for Safety By Closing and Opening File
  1361.         CALL OpenAppts                     
  1362.         GOTO ExitPoint4
  1363.     END IF
  1364.     '-------------------------------------------------------------------------
  1365.     '    Calculate Relative Record From Start of History/Notes
  1366.     '    Save It In History or Notes Relative Record
  1367.     CurrentNoteHist = MenuChoice + EditPagesize * CurrentPage
  1368.     IF NotesorHistory$ = "H" THEN
  1369.         CurrentHistory = CurrentNoteHist
  1370.       ELSE
  1371.         CurrentNote = CurrentNoteHist
  1372.     END IF
  1373.     '-------------------------------------------------------------------------
  1374.     '     Refresh Parameters--Process Result of Editing
  1375.     GOSUB SetupNotes
  1376.     MenuSingleLine = Yes
  1377.     SELECT CASE MenuSpecialExit
  1378.         CASE SpecialExitDisallowed    ' Return
  1379.         '  "Enter" A Change--First Write Deleted Note Record To History
  1380.             GOSUB DeletedToHistory
  1381.             '---------------------------------------------------------------
  1382.             '     Type In The Changed Data For A Line Of History Or Notes
  1383.             IF ClockScreen THEN CALL Kolors(N3) ELSE CALL Kolors(N5)
  1384.             CALL ClearLast4
  1385.             FOR I = N1 TO N4
  1386.                 CALL ShowIt(N14, N21 + I, N34, NoteInput(I))
  1387.             NEXT
  1388.             BoxRow = MenuRow + MenuChoice
  1389.             InputResponse$ = LEFT$(MenuLines(MenuChoice), N75)
  1390.             CALL ControlledInput(BoxRow, N6, BoxRow, N6, N75, _
  1391.                 Blank0$, InputResponse$, N0, N0, N0, N1)
  1392.             MenuLines(MenuChoice) = InputResponse$
  1393.             OnScreenFirst = Yes
  1394.             '---------------------------------------------------------------
  1395.             '     Rewrite The Record In The File And Do It Again
  1396.             CALL MhLset(ApptBuffer$, (MenuLines(MenuChoice)))
  1397.             CALL PutApptRecord(ApptFileRec)
  1398.             GOTO StartEdit
  1399.             '---------------------------------------------------------------
  1400.             '     Write A Deleted Note Record To History
  1401. DeletedToHistory:
  1402.             IF NotesorHistory$ <> "H" AND MenuLines(MenuChoice) <> Blank80$ _
  1403.                AND MID$(MenuLines$(MenuChoice), N1, N71) <> SPACE$(N71) THEN
  1404.                 EventtoHistory = No
  1405.                 HistoryBuffer$ = LEFT$(MenuLines(MenuChoice), N71) + _
  1406.                     SPACE$(N9)
  1407.                 CALL WritetoHistory
  1408.             END IF
  1409.             GOSUB SetupNotes
  1410.             RETURN
  1411.             '---------------------------------------------------------------
  1412.         CASE SpecialExitInsert        ' Insert
  1413.             ' "Insert" One Or More Lines
  1414.             '    --Find Out How Many (InsCount)
  1415.             ' If Too Many Lines On Notes,
  1416.             '    Set Number Of Lines To Difference To End
  1417.             CALL ClearLast4
  1418.             InsCount = N0
  1419.             InputResponse$ = MID$(STR$(InsCount), N2, N4)
  1420.             CALL ControlledInput(N23, N32, N23, N5, N4, _
  1421.                 "How Many Lines To Insert?", InputResponse$, _
  1422.                 N1, N0, N1, N1)
  1423.             CALL ClearLast4
  1424.             InsCount = VAL(InputResponse$)
  1425.             IF NotesorHistory$ = "N" AND _
  1426.                CurrentNoteHist + InsCount > LastRecord + N1 THEN
  1427.                 InsCount = LastRecord - CurrentNoteHist + N1
  1428.             END IF
  1429.             '---------------------------------------------------------------
  1430.             '  If Notes And Inserting Before Last Record, Just Blank It Out
  1431.             IF OnScreen THEN OnScreenFirst = Yes
  1432.             IF InsCount <= N0 OR Keystroke$ = CHR$(Esc) THEN
  1433.                 CALL MinorBeeper
  1434.                 GOTO StartAll
  1435.             END IF
  1436.             ExitKeys = No
  1437.             IF NotesorHistory$ = "N" AND CurrentNoteHist = LastRecord THEN
  1438.                 MenuSingleLine = Yes
  1439.                 GOSUB DeleteSingle
  1440.                 GOTO StartEdit
  1441.             END IF
  1442.             IF NotesorHistory$ = "N" THEN
  1443.                 '----------------------------------------------------------
  1444.                 '  If Notes And Before Last Record,
  1445.                 '    Put Each Off-End Record To History
  1446.                 '      Then Blank Out Place
  1447.                 '         Where It Came From (Effect Of Insert)
  1448.                 FOR JJ = InsCount TO N1 STEP Nm1
  1449.                     CALL KeyStuff(KeyStatus)
  1450.                     Pointer = StartingNote + LastRecord - JJ
  1451.                     CALL GetApptRecord(Pointer)
  1452.                     IF ApptBuffer$ <> Blank80$ THEN
  1453.                         Pointer = LOF(FilenumAppt) \ N80 + N1
  1454.                         CALL PutApptRecord(Pointer)
  1455.                         CALL MhLset(ApptBuffer$, Blank80$)
  1456.                         Pointer = StartingNote + LastRecord - JJ
  1457.                         CALL PutApptRecord(Pointer)
  1458.                     END IF
  1459.                 NEXT
  1460.                 ' Then Move Each Non-Off-End Note Record Down In The File
  1461.                 '       InsCount Lines
  1462.                 MoveEnd = CurrentNoteHist + InsCount
  1463.                 CALL MoveApptRecords(FileStart, LastRecord, MoveEnd, _
  1464.                     Nm1, -InsCount, N0, N1, N1, -InsCount)
  1465.               ELSE
  1466.                 '----------------------------------------------------------
  1467.                 ' If History,
  1468.                 '    Just Move Each Record Down InsCount Places
  1469.                 '     In The File
  1470.                 '   First From The End Back To The Last Back To The Current
  1471.                 MoveEnd = CurrentNoteHist
  1472.                 CALL MoveApptRecords(FileStart, LastRecord, _
  1473.                     MoveEnd, Nm1, N0, InsCount, N1, N1, N0)
  1474.                 '  And Then Blank Out The Area Moved
  1475.                 '    Out Of InsCount Places
  1476.                 MoveEnd = CurrentNoteHist + InsCount - N1
  1477.                 CALL MoveApptRecords(FileStart, LastRecord + N1, _
  1478.                     MoveEnd, N1, N0, N0, N0, N1, N0)
  1479.             END IF
  1480.             GOTO StartAll
  1481.             '----------------------------------------------------------------
  1482.             ' Delete A Single History Or Note Record ApptFileRec
  1483. DeleteSingle:
  1484.             GOSUB DeletedToHistory
  1485.             CALL Myd2(MenuLines(MenuChoice), N1, N71, SPACE$(N71))
  1486.             CALL MhLset(ApptBuffer$, Blank80$)
  1487.             CALL PutApptRecord(ApptFileRec)
  1488.             RETURN
  1489.             '----------------------------------------------------------------
  1490.         CASE SpecialExitDelete        ' Delete
  1491.             '---------------------------------------------------------------
  1492.             '     Delete Records--Determine How Many Lines To Delete
  1493.             '       If More Than Difference End To Current, Limit It
  1494.             CALL ClearLast4
  1495.             DelCount = N0
  1496.             InputResponse$ = MID$(STR$(DelCount), N2, N4)
  1497.             CALL ControlledInput(N23, N32, N23, N5, N4, _
  1498.                 "How Many Lines To Delete?", InputResponse$, _
  1499.                 N1, N0, N1, N1)
  1500.             CALL ClearLast4
  1501.             DelCount = VAL(InputResponse$)
  1502.             IF DelCount > LastRecord - CurrentNoteHist + N1 THEN
  1503.                 DelCount = LastRecord - CurrentNoteHist + N1
  1504.             END IF
  1505.             IF OnScreen THEN OnScreenFirst = Yes
  1506.             ' If Notes And Deleting Last Record,
  1507.             '   Just Write History & Blank It Out
  1508.             ExitKeys = No
  1509.             IF DelCount <= N0 OR Keystroke$ = CHR$(Esc) THEN
  1510.                 CALL MinorBeeper
  1511.                 GOTO StartAll
  1512.               ELSEIF NotesorHistory$ = "N" AND _
  1513.                     CurrentNoteHist = LastRecord THEN
  1514.                     MenuSingleLine = Yes
  1515.                     GOSUB DeleteSingle
  1516.                     GOTO StartEdit
  1517.             END IF
  1518.             IF NotesorHistory$ = "N" THEN
  1519.                 '----------------------------------------------------------
  1520.                 '     If Notes, Put Each Deleted Record To History,
  1521.                 '         And Blank It Out
  1522.                 FOR JJ = N1 TO DelCount
  1523.                     CALL KeyStuff(KeyStatus)
  1524.                     Pointer = StartingNote - N2 + JJ + CurrentNoteHist
  1525.                     CALL GetApptRecord(Pointer)
  1526.                     IF ApptBuffer$ <> Blank80$ THEN
  1527.                         HistoryBuffer$ = ApptBuffer$
  1528.                         EventtoHistory = No
  1529.                         CALL WritetoHistory
  1530.                         CALL MhLset(ApptBuffer$, Blank80$)
  1531.                         Pointer = StartingNote - N2 + JJ + _
  1532.                                     CurrentNoteHist
  1533.                         CALL PutApptRecord(Pointer)
  1534.                     END IF
  1535.                 NEXT
  1536.             END IF
  1537.             '---------------------------------------------------------------
  1538.             '  Then Move Each Record Backwards In The File
  1539.             '    DelCount Places
  1540.             '       Blanking The Place Where It Came From
  1541.             MoveStart = CurrentNoteHist + DelCount
  1542.             CALL MoveApptRecords(FileStart, MoveStart, LastRecord, _
  1543.                 N1, N0, -DelCount, N1, N1, N0)
  1544.             IF NotesorHistory$ = "N" THEN GOTO StartAll
  1545.             '  Then If Its History, Compress The File
  1546.             '    Down DelCount+Null Records
  1547.             CALL CompressApptFile(DelCount)
  1548.             GOTO StartAll
  1549.         CASE SpecialExitPgUp          ' Page Up
  1550.             IF CurrentPage < N1 THEN
  1551.                 CurrentPage = N0
  1552.                 GOTO ErrorBeep
  1553.               ELSE
  1554.                 CurrentPage = CurrentPage - N1
  1555.                 GOTO ChangePage
  1556.             END IF
  1557.         CASE SpecialExitPgDn          ' Page Down
  1558.             IF CurrentPage >= LastPage THEN
  1559.                 CurrentPage = LastPage
  1560.                 GOTO ErrorBeep
  1561.               ELSE
  1562.                 CurrentPage = CurrentPage + N1
  1563.                 GOTO ChangePage
  1564.             END IF
  1565.         CASE SpecialExitF2       ' F2
  1566.             CALL MinorBeeper
  1567.             GOTO StartAll
  1568.         CASE SpecialExitHomeKey       ' Home
  1569.             IF CurrentPage < N1 THEN
  1570.                 CurrentPage = N0
  1571.                 GOTO ErrorBeep
  1572.               ELSE
  1573.                 CurrentPage = N0
  1574.                 GOTO ChangePage
  1575.             END IF
  1576.         CASE SpecialExitEndKey        ' End
  1577.             IF CurrentPage >= LastPage THEN
  1578.                 CurrentPage = LastPage
  1579.                 GOTO ErrorBeep
  1580.               ELSE
  1581.                 CurrentPage = LastPage
  1582.             END IF
  1583.             '     Reset Record Indicators And Go To That Page
  1584. ChangePage:
  1585.             CurrentNoteHist = N1 + EditPagesize * CurrentPage
  1586.             IF NotesorHistory$ = "H" THEN
  1587.                 CurrentHistory = CurrentNoteHist
  1588.               ELSE
  1589.                 CurrentNote = CurrentNoteHist
  1590.             END IF
  1591.             GOTO StartAll
  1592.         CASE ELSE                     ' F2
  1593.             CALL MinorBeeper
  1594.             GOTO StartAll
  1595.     END SELECT
  1596.     '-------------------------------------------------------------------------
  1597.     '     Set The Current Parameters Up For Notes, Default Notes To Beginning
  1598.     '   Start Record, End Page, End Relative Record, Current Relative Record
  1599. SetupNotes:
  1600.     IF NotesorHistory$ = "N" THEN
  1601.         FileStart = StartingNote
  1602.         LastRecord = NumberofNotes
  1603.         IF CurrentNote <= N0 THEN
  1604.             CurrentNote = N1
  1605.           ELSEIF CurrentNote > LastRecord THEN
  1606.             CurrentNote = LastRecord
  1607.         END IF
  1608.         LastPage = NumberofNotes \ EditPagesize - N1
  1609.         CurrentNoteHist = CurrentNote
  1610.       ELSE
  1611.         '  Set The Current Parameters Up For History, Default History To End
  1612.         '  Start Record, End Page, End Relative Record,
  1613.         '    Current Relative Record
  1614.         FileStart = StartingHistory
  1615.         '  Hist Page = 20
  1616.         LastPage = ((LOF(FilenumAppt) \ N80) - StartingHistory) \ N20
  1617.         LastRecord = LOF(FilenumAppt) \ N80 - StartingHistory + N1
  1618.         IF NOT NoHistEndDefault THEN
  1619.             CurrentHistory = LastRecord
  1620.           ELSEIF CurrentHistory <= N0 OR CurrentHistory > LastRecord THEN
  1621.             CurrentHistory = LastRecord
  1622.         END IF
  1623.         CurrentNoteHist = CurrentHistory
  1624.     END IF
  1625.     CurrentPage = (CurrentNoteHist - N1) \ EditPagesize
  1626.     ApptFileRec = FileStart + CurrentNoteHist - N1
  1627.     NoHistEndDefault = Yes
  1628.     RETURN
  1629.     '-------------------------------------------------------------------------
  1630.     '  Error Return At MenuDriver Response
  1631. ErrorBeep:
  1632.     CALL MinorBeeper
  1633.     GOTO StartEdit
  1634. ExitPoint4:
  1635.     EditingNotes = No
  1636.         Subnum = SubnumSave
  1637.     END SUB
  1638.     '=========================================================================
  1639.     FUNCTION NumberError (NumberTest$) STATIC
  1640.     '=========================================================================
  1641.     '   Numeric Value Tester for Strings, Returns NumberError =0 good <>0 bad
  1642.     DEFINT A-Z
  1643.         SubnumSave = Subnum
  1644.         Subnum = 44
  1645.     NumberLength = LEN(NumberTest$)
  1646.     NumberError = N0
  1647.     FOR WhichDigit = N1 TO NumberLength
  1648.         IF InString("0123456789", _
  1649.                   MID$(NumberTest$, WhichDigit, N1)) = N0 THEN
  1650.             NumberError = N1
  1651.             EXIT FOR
  1652.         END IF
  1653.     NEXT
  1654.         Subnum = SubnumSave
  1655.     END FUNCTION
  1656.     '=========================================================================
  1657.     SUB OpenAppts STATIC
  1658.     '=========================================================================
  1659.     DEFINT A-Z
  1660.         SubnumSave = Subnum
  1661.         Subnum = 45
  1662.     CALL CloseFiles
  1663.     OPEN "R", FilenumAppt, ApptFilename$ + ".cld", N80
  1664.     ' For Appointment File, Use ApptBuffer$ As Random 80-Character Buffer
  1665.     FIELD FilenumAppt, N80 AS ApptBuffer$
  1666.     ApptFile = Yes
  1667.     ApptFilenameOverdue$ = LTRIM$(RTRIM$(ApptFilename$)) + ".clv"
  1668.         Subnum = SubnumSave
  1669.     END SUB
  1670.     '=========================================================================
  1671.     SUB Options STATIC
  1672.     '=========================================================================
  1673.     '   Process Options Change Request
  1674.     DEFINT A-Z
  1675.         SubnumSave = Subnum
  1676.         Subnum = 46
  1677.     CALL GetOptions
  1678. NewScreen:
  1679.     DirectReturn = Yes
  1680.     CALL ClearScreenNormal(N1)
  1681.     ScreenTitles$(N1) = "Options for Appointment File"
  1682.     CALL Titles(N1)
  1683.     IF FooterRecallMsg$ = True$ THEN
  1684.         CALL PrepareforMessage
  1685.         CALL ShowIt(N0, N0, N0, _
  1686. "Clock Screen Help Instructions Will Be Suppressed--Use F5 To Recall Them")
  1687.     END IF
  1688.     MenuLines(N1) = "Number Of Clock Footer Lines To Display Events And" + _
  1689.         " Notes, Currently " + RIGHT$(STR$(FooterSize), N1)
  1690.     MenuLines(N2) = "Number Of Note Lines To Display, Currently " + _
  1691.         RIGHT$(STR$(NoteSize), N1)
  1692.     ScreenTag$ = SoundLevels$(SoundLevel)
  1693.     MenuLines(N3) = _
  1694.         "Condition Of Sound On First Entry, Currently " + ScreenTag$
  1695.     MenuLines(N4) = "Music Options"
  1696.     MenuLines(N5) = "Appointment File Password"
  1697.     IF WeekendScheduling$ <> True$ THEN 
  1698.         ScreenTag$ = Noo$ 
  1699.       ELSE 
  1700.         ScreenTag$ = Yess$
  1701.     END IF
  1702.     MenuLines(N6) = _
  1703.         "Allow Daily Events To Occur On Weekends, Currently " + ScreenTag$
  1704.     MenuLines(N7) = _
  1705. "Minutes of Warning for Pending Events, Currently " + RIGHT$(STR$(Pending), N2)
  1706.     IF NOT InclNotes THEN ScreenTag$ = Noo$ ELSE ScreenTag$ = Yess$
  1707.     MenuLines(N8) = _
  1708.         "Include Notes In Print Or ASCII File, Currently " + ScreenTag$
  1709.     IF NOT InclHistory THEN ScreenTag$ = Noo$ ELSE ScreenTag$ = Yess$
  1710.     MenuLines(N9) = "Include History In Print Or ASCII File, Currently " + _
  1711.         ScreenTag$
  1712.     IF WeekBreak$ <> True$ THEN ScreenTag$ = Noo$ ELSE ScreenTag$ = Yess$
  1713.     MenuLines(N10) = _
  1714.         "Break Between Weeks In Print Or ASCII File, Currently " + ScreenTag$
  1715.     MenuLines(N11) = "Set 1 or 2 Event Texts to Exclude From History Recording"
  1716.     MenuLines(N12) = "Choose Printer Type or Set Page Size/Break"
  1717.     MenuLines(N13) = _
  1718. "Change Event Capacity In Appointment File, Currently" + STR$(NumberofEvents)
  1719.     MenuLines(N14) = _
  1720. "Change Note Capacity In Appointment File, Currently" + STR$(NumberofNotes)
  1721.     '    Options Menu Choice
  1722.     CALL MenuDriver(N14, Menu4, N6, Nm1, No, N0, N1, N1)
  1723.     FooterRecallMsg$ = False$
  1724.     IF MenuExit = MenuCancelled THEN
  1725.         CALL SetOptions
  1726.         CALL GetOptions
  1727.         CALL ClearScreenNormal(N1)
  1728.         Menu1 = MainMenuLastEntry
  1729.         ' Flush I/O Buffers for Safety
  1730.         CALL OpenAppts                     '  By Closing and Opening File
  1731.         GOTO ExitPoint5
  1732.     END IF
  1733.     SELECT CASE Menu4
  1734.         CASE N1                        '  Clock Footer Size
  1735.         '====================================================================
  1736.             CALL ClearScreenNormal(N1)
  1737.             ScreenTitles$(N1) = "Select Desired Clock Footer Size"
  1738.             ScreenTitles$(N2) = "For Both Events And Notes"
  1739.             ScreenTitles$(N3) = "(Footer Sizes 6 through 9"
  1740.             ScreenTitles$(N4) = "Suppress Clock Screen Instructions)"
  1741.             CALL Titles(N4)
  1742.             FOR JJ = N3 TO N9
  1743.                 MenuLines(JJ - N2) = MID$(STR$(JJ), N2, N1)
  1744.             NEXT
  1745.             MenuChoice = FooterSize - N2
  1746.             CALL MenuDriver(N7, MenuChoice, N6, Nm1, No, N0, N1, N1)
  1747.             IF MenuExit = MenuCancelled THEN GOTO NewScreen
  1748.             FooterSize = MenuChoice + N2
  1749.             IF FooterSize > N5 THEN FooterRecallMsg$ = True$
  1750.             ' Must Have At Least N1 Event
  1751.             IF (NoteSize + N1) > FooterSize THEN NoteSize = FooterSize - N1
  1752.         '====================================================================
  1753.         CASE N2                        '  Note Window Size
  1754.             CALL ClearScreenNormal(N1)
  1755.             ScreenTitles$(N1) = "Select Size Of"
  1756.             ScreenTitles$(N2) = "Note Area In Footer"
  1757.             CALL Titles(N2)
  1758.             FOR JJ = N1 TO FooterSize           ' 0 is also allowed
  1759.                 MenuLines(JJ) = MID$(STR$(JJ - N1), N2, N1)
  1760.             NEXT
  1761.             MenuChoice = NoteSize + N1
  1762.             CALL MenuDriver(FooterSize, MenuChoice, N6, Nm1, _
  1763.                 No, N0, N1, N1)
  1764.             IF MenuExit = MenuCancelled THEN GOTO NewScreen
  1765.             NoteSize = MenuChoice - N1
  1766.         '====================================================================
  1767.         CASE N3                        '  Initial Sound Setting
  1768.             CALL ClearScreenNormal(N1)
  1769.             ScreenTitles$(N1) = "Set Initial Condition of Sound"
  1770.             CALL Titles(N1)
  1771.             MenuLines(N1) = "Totally Silent"
  1772.             MenuLines(N2) = "Errors Only"
  1773.             MenuLines(N3) = "Alarms, Warnings, and Errors"
  1774.             MenuLines(N4) = "Chimes, Alarms, Warnings, and Errors"
  1775.             CALL MenuDriver(N4, SoundLevel, N6, Nm1, No, N0, N1, N1)
  1776.             IF MenuExit = MenuCancelled THEN GOTO NewScreen
  1777.         '====================================================================
  1778.         CASE N4                        '  Music Changes
  1779. MusicOption:
  1780.             CALL ClearScreenNormal(N1)
  1781.             ScreenTitles$(N1) = "Music Options"
  1782.             CALL Titles(Nm1)
  1783.             MenuLines(N1) = _
  1784.                 "Music That Is Played When a Pending Event Warning Occurs"
  1785.             MenuLines(N2) = _
  1786.                 "Music That Is Played When Event Alarm Occurs"
  1787.             MenuLines(N3) = _
  1788.                 "Music That Is Played When Hour Clock Chime Sounds"
  1789.             CALL MenuDriver(N3, MusicOption, N6, Nm1, No, N0, N1, N1)
  1790.             IF MenuExit = MenuCancelled THEN GOTO NewScreen
  1791.             CALL ReadCalmusic
  1792.             '           Get Current Music Values
  1793.             CALL ClearScreenNormal(N1)
  1794.             ScreenTitles$(N1) = "Set Music Choices"
  1795.             CALL Titles(Nm1)
  1796.             CALL ShowIt(N6, N8, N1, "Make Changes To PLAY String For ")
  1797.             SELECT CASE MusicOption
  1798.                 CASE N1
  1799.                     CALL ShowIt(N0, N0, Nm1, "Pending Event Warning")
  1800.                 CASE N2
  1801.                     CALL ShowIt(N0, N0, Nm1, "Alarms")
  1802.                 CASE N3
  1803.                     CALL ShowIt(N0, N0, Nm1, "Chimes")
  1804.             END SELECT
  1805.             CALL ShowIt(N0, N9, N1, _
  1806.  "(Consult PLAY Statement In IBM or Microsoft BASIC Reference Manual For Use)")
  1807.             CALL ShowIt(N0, Nm1, N0, _
  1808.     "(Errors Are Detected Only If Sound Options Allow Music To Be Played)")
  1809.             GOSUB WhichMusic
  1810.             GOTO ProcessMistake
  1811. WhichMusic:
  1812.             SELECT CASE MusicOption
  1813.                 CASE N1
  1814.                     PlayString$ = Warning$
  1815.                 CASE N2
  1816.                     PlayString$ = Alarm$
  1817.                 CASE N3
  1818.                     PlayString$ = Chime$
  1819.             END SELECT
  1820.             CALL ShowIt(N7, N12, N1, PlayString$)
  1821.             ErrorSwitch = No
  1822.             SELECT CASE MusicOption
  1823.                 CASE N1, 2
  1824.                     IF SoundLevel > N2 THEN CALL PlayStuff(PlayString$)
  1825.                 CASE N3
  1826.                     IF SoundLevel > N3 THEN CALL PlayStuff(PlayString$)
  1827.             END SELECT
  1828.             IF ErrorSwitch THEN
  1829.                 ErrorSwitch = No
  1830.                 CALL PrepareforMessage
  1831.                 CALL MajorBeeper
  1832.                 CALL ShowIt(N0, N0, N0, _
  1833.     ("There is a Mistake in Your PLAY String -- " + "Correct it and Try Again"))
  1834.             END IF
  1835.             RETURN
  1836. ProcessMistake:
  1837.             SELECT CASE MusicOption
  1838.                 CASE N1
  1839.                     InputResponse$ = Warning$
  1840.                 CASE N2
  1841.                     InputResponse$ = Alarm$
  1842.                 CASE N3
  1843.                     InputResponse$ = Chime$
  1844.             END SELECT
  1845.             CALL ControlledInput(N12, N1, N12, N1, N80, Blank0$, _
  1846.                 InputResponse$, N0, N1, N1, N1)
  1847.             CALL BlankFatal
  1848.             SELECT CASE MusicOption
  1849.                 CASE N1
  1850.                     Warning$ = InputResponse$
  1851.                 CASE N2
  1852.                     Alarm$ = InputResponse$
  1853.                 CASE N3
  1854.                     Chime$ = InputResponse$
  1855.             END SELECT
  1856.             '  Write the Result if Finished, Else Try Again
  1857.             IF CHR$(Esc) = RIGHT$(Keystroke$, N1) THEN
  1858.                 CALL WriteCalmusic
  1859.                 GOTO MusicOption
  1860.             END IF
  1861.             GOSUB WhichMusic
  1862.             GOTO ProcessMistake
  1863.         '====================================================================
  1864.         CASE N5                        '  Appointment File Password Change
  1865.             CALL ClearScreenNormal(N1)
  1866.             ScreenTitles$(N1) = "Change Appointment File Password"
  1867.             CALL Titles(N1)
  1868.             CALL ShowIt(N6, N6, N1, "Enter New Password")
  1869.             InputResponse$ = Blank8$
  1870.             CALL ControlledInput(N8, N1, N8, N22, N8, _
  1871.                 "Change Password To: ", InputResponse$, N0, N1, N1, N1)
  1872.             EnteredPassword$ = InputResponse$
  1873.             IF CHR$(Enter) = RIGHT$(Keystroke$, N1) THEN 
  1874.                 ApptPassword$ = EnteredPassword$
  1875.             END IF
  1876.         '====================================================================
  1877.         CASE 6                        '  Weekend Rescheduling of Dailies
  1878.             IF WeekendScheduling$ <> True$ THEN
  1879.                 WeekendScheduling$ = True$
  1880.               ELSE
  1881.                 WeekendScheduling$ = False$
  1882.             END IF
  1883.         '====================================================================
  1884.         CASE N7                        '  Warning Time
  1885.             CALL ClearScreenNormal(N1)
  1886.             ScreenTitles$(N1) = "Select Minutes of Warning"
  1887.             ScreenTitles$(N2) = "For Pending Events"
  1888.             ScreenTitles$(N3) = "(Selecting 0 Means that"
  1889.             ScreenTitles$(N4) = "No Warning Is Given)"
  1890.             CALL Titles(N4)
  1891.             PendingHold = Pending
  1892.             InputResponse$ = MID$(STR$(Pending), N2, N2)
  1893.             CALL ControlledInput(N12, N60, N12, N20, N2, _
  1894.     "Enter Minutes of Warning (0 to 99)", InputResponse$, N1, N1, N1, N1)
  1895.             IF Keystroke$ = CHR$(Esc) THEN GOTO NewScreen
  1896.             Pending = VAL(InputResponse$)
  1897.             IF Pending <> PendingHold THEN     ' If a different warning time
  1898.                 EventTableStable = No        '  then rebuild alarm table
  1899.             END IF                        '  because warnings no good
  1900.         '====================================================================
  1901.         CASE N8                        '  Notes in Print/Copy
  1902.             IF NOT InclNotes THEN
  1903.                 InclNotes = Yes
  1904.               ELSE
  1905.                 InclNotes = No
  1906.             END IF
  1907.         '====================================================================
  1908.         CASE N9                        '  History in Print/Copy
  1909.             IF NOT InclHistory THEN
  1910.                 InclHistory = Yes
  1911.               ELSE
  1912.                 InclHistory = No
  1913.             END IF
  1914.         '====================================================================
  1915.         CASE N10                       '  Week Break in Print/Copy
  1916.             IF WeekBreak$ <> True$ THEN
  1917.                 WeekBreak$ = True$
  1918.               ELSE
  1919.                 WeekBreak$ = False$
  1920.             END IF
  1921.         '====================================================================
  1922.         CASE N11                       '  History Exclusion of Events
  1923.             CALL ReadCalexcl
  1924.             '           Get Exclude Text Values
  1925.             CALL ClearScreenNormal(N1)
  1926.             ScreenTitles$(N1) = "Specify Event Exclusions From History"
  1927.             CALL Titles(Nm1)
  1928.             CALL ShowIt(N6, N6, N1, _
  1929.                 "Enter Event Text to Exclude From History Recording")
  1930.             CALL ShowIt(N0, Nm1, N0, _
  1931.                 "      (Blank if No Exclusions are Desired)")
  1932.             CALL ShowIt(N0, Nm1, N0, _
  1933.                 "   All Other Event Text is Recorded in History")
  1934.             FOR J = N1 TO N2
  1935.               BoxRow = N11 + N4 * J
  1936.               MessageRow = N9 + N4 * J
  1937.               MessageText$ = "Text" + STR$(J) + ":"
  1938.               InputResponse$ = ExcludefromHistory$(J)
  1939.               CALL ControlledInput(BoxRow, N1, MessageRow, N15, TextSize, _
  1940.                 MessageText$, InputResponse$, N0, N1, N1, N1)
  1941.               IF Keystroke$ = CHR$(Esc) THEN GOTO NewScreen  'Early Exit
  1942.               ExcludefromHistory$(J) = InputResponse$
  1943.             NEXT
  1944.             '  Write the Result
  1945.             CALL WriteCalexcl
  1946.         '====================================================================
  1947.         CASE N12                       '  Printer Type Choice and Paging
  1948. PrinterScreen:
  1949.             CALL ClearScreenNormal(N1)
  1950.             ScreenTitles$(N1) = "Choose Printer / Set Paging"
  1951.             CALL Titles(N1)
  1952.             MenuLines(N1) = "Epson FX Printer or Emulated Equivalent"
  1953.             MenuLines(N2) = "IBM PC 4-Band Color Printer"
  1954.             MenuLines(N3) = "HP IIP, III, or IIID LaserJet Printer"
  1955.             MenuLines(N4) = "IBM 4019-E01 or 4019-001 LaserPrinter"
  1956.             MenuLines(N5) = "Don't Send Printer Initialization Parameters"
  1957.             MenuLines(N6) = "Change Printer Page Length, Currently" + _
  1958.                     STR$(PrinterLineLimit) + " Lines"
  1959.             IF PrinterPause$ <> True$ THEN 
  1960.                 ScreenTag$ = Noo$ 
  1961.               ELSE 
  1962.                 ScreenTag$ = Yess$
  1963.             END IF
  1964.             MenuLines(N7) = "Set Pause Between Pages, Currently " + _
  1965.                 ScreenTag$
  1966.             MenuChoice = InString(AvailablePrinters$, SelectedPrinter$)
  1967.             IF MenuChoice = N0 THEN MenuChoice = N1    ' Epson Default
  1968.             CALL MenuDriver(LEN(AvailablePrinters$) + N2, MenuChoice, _
  1969.                 N6, Nm1, No, N0, N1, N1)
  1970.             IF MenuExit = MenuCancelled THEN GOTO NewScreen
  1971.             SELECT CASE MenuChoice
  1972.                 CASE N1 TO LEN(AvailablePrinters$)        'Printer Choice
  1973.                     SelectedPrinter$ = MID$(AvailablePrinters$, _
  1974.                         MenuChoice, N1)
  1975.                 CASE MenuSize - N1                'Page Length
  1976. SetLineLimit:
  1977.                     CALL PrepareForMessage
  1978.                     CALL ShowIt(N0, N0, N0, _
  1979.     "Enter Number of Print Lines Per Page (0 means no paging and no pause)")
  1980.                     InputResponse$ = MID$(STR$(PrinterLineLimit), N2, N2)
  1981.                     BoxRow = MenuRow + MenuSize + N5
  1982.                     MessageRow = BoxRow
  1983.                     CALL ControlledInput(BoxRow, N60, MessageRow, N20, _
  1984.       N2, "Enter Printer Line Limit (0 to 99)", InputResponse$, N1, N1, N1, N1)
  1985.                     IF Keystroke$ = CHR$(Esc) THEN GOTO NewScreen
  1986.                     PrinterLineLimit = VAL(InputResponse$)
  1987.                     CALL BlankError
  1988.                 CASE MenuSize                    'Page Break
  1989.                     IF PrinterPause$ = True$ THEN         'Toggle
  1990.                         PrinterPause$ = False$
  1991.                       ELSE 
  1992.                         PrinterPause$ = True$
  1993.                         IF PrinterLineLimit = 0 THEN
  1994.                             GOTO SetLineLimit
  1995.                         END IF
  1996.                     END IF
  1997.             END SELECT
  1998.         '====================================================================
  1999.         CASE N13, N14              '  Event/Note Capacity In Appointment File
  2000.             CALL ClearScreenNormal(N1)
  2001.             IF Menu4 = N13 THEN
  2002.                 ScreenTitles$(N1) = "Change Number of Events"
  2003.                 MenuChoice = (NumberofEvents \ N20)
  2004.               ELSE
  2005.                 ScreenTitles$(N1) = "Change Number of Notes"
  2006.                 MenuChoice = (NumberofNotes \ N20)
  2007.             END IF
  2008.             ScreenTitles$(N2) = "In Appointment File"
  2009.             CALL Titles(N2)
  2010.             WhichExpansion$ = Blank1$
  2011.             OldNumberEvents = NumberofEvents
  2012.             OldNumberNotes = NumberofNotes
  2013.             OldMenuChoice = MenuChoice
  2014.             IF MenuChoice > N1 THEN
  2015.                 CALL ShowIt(N7, N9, N1, " Warning! --           ")
  2016.                 CALL ShowIt(N0, Nm1, N0, " If You Pick A Smaller ")
  2017.                 CALL ShowIt(N0, Nm1, N0, " Size, Then The Extra  ")
  2018.                 CALL ShowIt(N0, Nm1, N0, " Entries At The End Of ")
  2019.                 CALL ShowIt(N0, Nm1, N0, " The List Will Be      ")
  2020.                 CALL ShowIt(N0, Nm1, N0, " Written To History!   ")
  2021.             END IF
  2022.             FOR JJ = N1 TO LEN(ValidSizes$)
  2023.                 MenuLines(JJ) = RIGHT$(STR$(N20 * JJ), Nm1 + _
  2024.                     LEN(STR$(N20 * JJ)))
  2025.             NEXT
  2026.             MenuSize = LEN(ValidSizes$)
  2027.             CALL MenuDriver(MenuSize, MenuChoice, N6, Nm1, _
  2028.                 No, N0, N1, N1)
  2029.             IF MenuExit = MenuCancelled THEN GOTO NewScreen
  2030.             IF Menu4 = N13 THEN
  2031.                 NumberofEvents = N20 * MenuChoice
  2032.                 WhichExpansion$ = "e"
  2033.               ELSE
  2034.                 NumberofNotes = N20 * MenuChoice
  2035.                 WhichExpansion$ = "n"
  2036.             END IF
  2037.             IF MenuChoice <> OldMenuChoice THEN
  2038.                 CALL Kolors(N6)
  2039.                 CALL ClearLast4
  2040.                 CALL FileFormat          ' Sets Options
  2041.             END IF
  2042.         '====================================================================
  2043.     END SELECT
  2044.     '-------------------------------------------------------------------------
  2045.     IF PrinterLineLimit = 0 THEN
  2046.         PrinterPause$ = False$
  2047.     END IF
  2048.     GOTO NewScreen
  2049. ExitPoint5:
  2050.         Subnum = SubnumSave
  2051.     END SUB
  2052.     '=========================================================================
  2053.     SUB PageEject STATIC
  2054.     '=========================================================================
  2055.     '   Printer Page Eject (Form Feed)
  2056.     DEFINT A-Z
  2057.         SubnumSave = Subnum
  2058.         Subnum = 47
  2059.     PrinterLineCount = 1
  2060.     CALL LprintString(CHR$(N12), N1)
  2061.         Subnum = SubnumSave
  2062.     END SUB
  2063.     '=========================================================================
  2064.     SUB PlayAlarmWarning (WarningSet) STATIC
  2065.     '=========================================================================
  2066.     '     Play Alarm or Warning Music
  2067.     DEFINT A-Z
  2068.         SubnumSave = Subnum
  2069.         Subnum = 48
  2070.     IF WarningSet THEN
  2071.         CALL PlayStuff(Warning$)
  2072.       ELSE
  2073.         CALL PlayStuff(Alarm$)
  2074.     END IF
  2075.     ErrorSwitch = No
  2076.         Subnum = SubnumSave
  2077.     END SUB
  2078.     '=========================================================================
  2079.     SUB PopLine STATIC
  2080.     '=========================================================================
  2081.     DEFINT A-Z
  2082.         SubnumSave = Subnum
  2083.         Subnum = 49
  2084.     IF NOT DOS2x THEN
  2085.         CALL PopLineDelete
  2086.         CALL ShowIt(N7, N24, N43, " F10," + UpArrow$ + "F10 ")
  2087.         CALL ShowIt(N6, N0, Nm1, "Pop Down")
  2088.     END IF
  2089.         Subnum = SubnumSave
  2090.     END SUB
  2091.     '=========================================================================
  2092.     SUB PopLineDelete STATIC
  2093.     '=========================================================================
  2094.     DEFINT A-Z
  2095.         SubnumSave = Subnum
  2096.         Subnum = 50
  2097.     IF NOT DOS2x THEN
  2098.         CALL ShowErase(N6, N24, N43, N19, Blank0$)
  2099.     END IF
  2100.         Subnum = SubnumSave
  2101.     END SUB
  2102.     '========================================================================
  2103.     '========================  END OF CAL4.BAS  =============================
  2104.     '========================================================================
  2105.